dropbox-sdk-java: Error loading version from resource "sdk-version.txt": Not found.

I am migrating Dropbox Android V2 API from V1 in my existing project. I have follow this documentation. I have existing project developed with Eclipse. So i have downloaded “dropbox-core-sdk-3.0.3.jar” and “jackson-core-2.9.0.pr3.jar” files and added under lib folder. The V2 dropbox login process works fine and also Auth.getOAuth2Token() method return correct token.

But i am getting issue on calling DropboxClient.getClient(ACCESS_TOKEN) method. I am receiving follwing error…

java.lang.RuntimeException: Error loading version from resource “sdk-version.txt”: Not found.

Full Error Stack:

 FATAL EXCEPTION: AsyncTask #1
 Process: com.android.myapp, PID: 23428
 java.lang.RuntimeException: An error occured while executing doInBackground()
 	at android.os.AsyncTask$3.done(AsyncTask.java:304)
 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
 	at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
 	at java.util.concurrent.FutureTask.run(FutureTask.java:242)
 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
 	at java.lang.Thread.run(Thread.java:818)
 Caused by: java.lang.ExceptionInInitializerError
 	at com.dropbox.core.DbxRequestUtil.buildUserAgentHeader(DbxRequestUtil.java:146)
 	at com.dropbox.core.DbxRequestUtil.addUserAgentHeader(DbxRequestUtil.java:131)
 	at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:228)
 	at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:100)
 	at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:256)
 	at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:97)
 	at com.dropbox.core.v2.users.DbxUserUsersRequests.getCurrentAccount(DbxUserUsersRequests.java:120)
 	at com.android.myapp.UserAccountTask.doInBackground(UserAccountTask.java:32)
 	at com.android.myapp.UserAccountTask.doInBackground(UserAccountTask.java:1)
 	at android.os.AsyncTask$2.call(AsyncTask.java:292)
 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
 	... 4 more
 Caused by: java.lang.RuntimeException: Error loading version from resource "sdk-version.txt": Not found.
 	at com.dropbox.core.DbxSdkVersion.loadVersion(DbxSdkVersion.java:66)
 	at com.dropbox.core.DbxSdkVersion.<clinit>(DbxSdkVersion.java:17)
 	... 15 more


About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25 (8 by maintainers)

Most upvoted comments

I think there is a bug somewhere in Android Studio 3.0 (+ Android gradle plugin 3.0). The apk built by Android Studio when I hit “Run” does not have Java resource files merged correctly (Java resources, not Android res). I verified it by decompiling the apk. Java resource files, and not only those from Dropbox SDK lib, are not there. The apk file (both debug and release) built by running gradle on the command line is assembled correctly.

I haven’t been able to pinpoint what exactly causes this bug in AS but I disabled both Instant Run and gradle daemon and that seems to make the problem go away.