cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Java API failure after Proguard handling

Java API failure after Proguard handling

L. Yeung1
New member | Level 1

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 1

Re: Java API failure after Proguard handling

Greg-DB
Dropboxer
Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?