Crittercism with proguard in Android

679 Views Asked by At

I'm using crittercism library in my Android project with proguard. When I compile my app, I get this error in console:

Warning: crittercism.android.c: can't find referenced method 'org.json.JSONArray put(long)' in class org.json.JSONArray

I can add a -dontwarn line to avoid this error, but crittercism doesn't work. I have read crittercism documentation to configure proguard file with this lines:

-keep public class com.crittercism.**
-keepclassmembers public class com.crittercism.**{ *; }

But I still have that error.

1

There are 1 best solutions below

0
On

Proguard error occours if there is a class, which present in both android framework and external library files(in your case its crittercism lib file). This causes an ambiguity to proguard.

You need to specify the exact class to keep in proguard (like -keep public class com.crittercism.abcd) instead of (-keep public class com.crittercism.*). Identify the exact class which is causing the conflict.

Its obvious that org.json.JSONArray is present in Android frame work and it might also present in crittercism api.

Identify where org.jason.JSONArray is present in crittercism library, and include in proguard file, like

-keep public class com.crittercism...JSONArray.