8

I have developed android application which contains Dropbox,Google drive and Box cloud service. I tested it and everything was working. After that I signed it and I realized that debug apk size was 8.5MB whereas signed apk size was 7MB.Still I tested complete application in which everything was working except Box cloud functionality.I got below exception

        11-28 12:51:14.129: E/AndroidRuntime(2702): FATAL EXCEPTION: main
    11-28 12:51:14.129: E/AndroidRuntime(2702): Process: com.idealtech.mycoud, PID: 2702
    11-28 12:51:14.129: E/AndroidRuntime(2702): java.lang.NoSuchFieldError: PUBLIC_ONLY
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at java.lang.Class.getDeclaredAnnotation(Native Method)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at java.lang.Class.getAnnotation(Class.java:290)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.b.a.c.f.ae.<clinit>(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.b.a.c.z.<clinit>(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxjavalibv2.jsonparsing.BoxJSONParser.<init>(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxjavalibv2.BoxClient.a(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxjavalibv2.BoxClient.<init>(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxjavalibv2.BoxClient.<init>(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxandroidlibv2.BoxAndroidClient.<init>(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxandroidlibv2.activities.OAuthActivity.a(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxandroidlibv2.activities.OAuthActivity.a(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.box.boxandroidlibv2.activities.OAuthActivity.onCreate(Unknown Source)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.app.Activity.performCreate(Activity.java:5248)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.app.ActivityThread.access$800(ActivityThread.java:139)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.os.Handler.dispatchMessage(Handler.java:102)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.os.Looper.loop(Looper.java:136)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at android.app.ActivityThread.main(ActivityThread.java:5086)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at java.lang.reflect.Method.invokeNative(Native Method)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at java.lang.reflect.Method.invoke(Method.java:515)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    11-28 12:51:14.129: E/AndroidRuntime(2702):     at dalvik.system.NativeStart.main(Native Method)

Its not getting library which it finds in debug.What do I do to fix this issue? Please help me. I couldnot release my application because of this issue. Thanks in advance.

SwapnilD
  • 117
  • 1
  • 13

1 Answers1

16

I got this issue because of jackson library while compiling it with proguard, I fixed it by adding following lines in proguard file.

-keepnames class com.fasterxml.jackson.** { 
*; 
}
-keepnames interface com.fasterxml.jackson.** { 
    *; 
}
Abhishek Patidar
  • 1,557
  • 1
  • 16
  • 25
  • 2
    That help to bring my crash app to not crashing (but still not working probably). I use Spice and Retrofit. – John Pang Mar 29 '15 at 16:29
  • did you got the solution. coz I am suffering from the same. I'am using retrofit with jackson . accepted answer resolved the error and warning message but not calling the remote webservice – Ram Mandal Oct 04 '16 at 04:18
  • The above code prevents proguard to avoid jackson library to not to obfusicate. It seems your retrofit proguard settings is wrong. Please check retrofit official proguard settings – Abhishek Patidar Oct 04 '16 at 04:32
  • Thanks ! Almost all the threads I have gone through on SO for this error, I have found that the usage of fasterxml.jackson gets me into the trouble. It worked for me after I added the lines in my proguard-rules.pro that's present in android app project structure. Initially I added it in proguard-android.txt, but it didn't work out. Seems this is the only solution for this issue. – user2582651 Mar 24 '17 at 18:40