We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
L. Yeung1
10 years agoNew member | Level 1
Java API failure after Proguard handling
Hi,
I am experiencing difficulties on Java API. My android app is working normally when Proguard setting "minifiEnabled" is set to false, but will be malfunction if set to true. The following log is the related detail.
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: java.util.concurrent.ExecutionException: com.dropbox.core.BadRequestException: Error in call to API function "users/get_current_account": Invalid authorization value in HTTP header "Authorization": "Bearer". Expecting "Bearer <oauth2-access-token>".
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.util.concurrent.FutureTask.report(FutureTask.java:94)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.util.concurrent.FutureTask.get(FutureTask.java:164)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at hk.com.fgoproduction.getdroplets.Lib.Common.ThisApplication.runOnBgAndJoin(ThisApplication.kt:58)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at hk.com.fgoproduction.getdroplets.Activity.MainActivity.threadExec(MainActivity.kt:187)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at hk.com.fgoproduction.getdroplets.Activity.MainActivity.dropboxStatus(MainActivity.kt:176)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at hk.com.fgoproduction.getdroplets.Activity.MainActivity.testAccessToken(MainActivity.kt:61)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at hk.com.fgoproduction.getdroplets.Activity.MainActivity.onCreate(MainActivity.kt:43)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.app.Activity.performCreate(Activity.java:6237)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.app.ActivityThread.-wrap11(ActivityThread.java)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.os.Looper.loop(Looper.java:148)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.lang.reflect.Method.invoke(Native Method)
06-15 10:05:00.623 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: Caused by: com.dropbox.core.BadRequestException: Error in call to API function "users/get_current_account": Invalid authorization value in HTTP header "Authorization": "Bearer". Expecting "Bearer <oauth2-access-token>".
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at com.dropbox.core.DbxRequestUtil.unexpectedStatus(DbxRequestUtil.java:285)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:107)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:252)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:97)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at com.dropbox.core.v2.users.DbxUserUsersRequests.getCurrentAccount(DbxUserUsersRequests.java:120)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at hk.com.fgoproduction.getdroplets.DropboxAPI.AFile.isDropboxOk(AFile.kt:139)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at hk.com.fgoproduction.getdroplets.Activity.MainActivity$dropboxStatus$1.run(MainActivity.kt:176)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-15 10:05:00.624 2823-2823/hk.com.fgoproduction.getdroplets W/System.err: at java.lang.Thread.run(Thread.java:818)
And the proguard-rules.pro is at the bottom
-dontobfuscate
-optimizationpasses 5
-dontpreverify
-optimizations !code/simplification/cast,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Appliction
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.view.View
-keep public class com.android.vending.licensing.ILicensingService
-keep class android.support.** {*;}
-keep class com.dropbox.** {*;}
-dontwarn com.dropbox.**
-keep class com.alibaba.fastjson.** {*;}
-dontwarn com.alibaba.fastjson.**
-dontwarn okhttp3.**
-dontwarn com.squareup.okhttp.**
-dontwarn com.google.appengine.**
-dontwarn javax.servlet.**
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
Does anyone have idea on this? It's a disaster that proguard could not be used as the app could not be published.
1 Reply
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://github.com/dropbox/dropbox-sdk-java/issues/58 ]
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,033 PostsLatest Activity: 3 years ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!