Archived Forum Post

Index of archived forum posts

Question:

java: android: crash: when using Proguard / minifyEnabled

Sep 23 '16 at 08:51

Hi,

tried to get Proguard working in my AndroidStudio build but unfortunately I was not able to get rid of this application crash as soon I activate Proguard obfuscation:

--------- beginning of crash 03-10 22:26:21.511 31553 31553 E AndroidRuntime: FATAL EXCEPTION: main 03-10 22:26:21.511 31553 31553 E AndroidRuntime: Process: de.tools.application, PID: 31553 03-10 22:26:21.511 31553 31553 E AndroidRuntime: java.lang.NoSuchMethodError: no static method "Lcom/chilkatsoft/chilkatJNI;.SwigDirector_CkBaseProgress_AbortCheck(Lcom/chilkatsoft/CkBaseProgress;)Z" 03-10 22:26:21.511 31553 31553 E AndroidRuntime: at com.chilkatsoft.chilkatJNI.swig_module_init(Native Method) 03-10 22:26:21.511 31553 31553 E AndroidRuntime: at com.chilkatsoft.chilkatJNI.<clinit>(Unknown Source) 03-10 22:26:21.511 31553 31553 E AndroidRuntime: at com.chilkatsoft.d.<init>(Unknown Source) 03-10 22:26:21.511 31553 31553 E AndroidRuntime: at de.tools.application.d.b.<init>(Unknown Source) 03-10 22:26:21.511 31553 31553 E AndroidRuntime: at de.tools.application.d.b.a(Unknown Source)

I tried several things out to get rid of this crash. But unfortunately without success. Perhaps you have ideas on that.

Many thanks and Br, Heiko


Answer

If you are using something that obfuscates your source code, then you are changing the names of variables and functions in the Java code, but the names of the native functions in the shared library (.so) cannot be changed. This would be the reason for the NoSuchErrorMethod.

What you are trying to do is inherently impossible. The names of JNI functions cannot change, otherwise there is a mismatch -- the native function names no longer match.