Java.lang.NoSuchFieldError: PUBLIC_ONLY when using Box api in android in a signed assembly

I developed an Android app that contains Dropbox, Google Drive, and Box's cloud service. I tested it and it worked. After that, I signed it, and I realized that the debug apk size was 8.5 MB, while the signed apk size was 7 MB. Until I tested the full application, in which everything worked, except for the functionality of cloud boxes. 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.bacfae.<clinit>(Unknown Source) 11-28 12:51:14.129: E/AndroidRuntime(2702): at com.bacz<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) 

I can’t get the library that it finds in debug. What should I do to fix this problem? Please help me. Due to this problem, I could not free my application. Thanks in advance.

+8
java android eclipse boxapiv2
source share
1 answer

I got this problem because of the jackson library when compiling with proguard, I fixed it by adding the following lines to the proguard file.

 -keepnames class com.fasterxml.jackson.** { *; } -keepnames interface com.fasterxml.jackson.** { *; } 
+15
source share

All Articles