Aditi
Aditi

Reputation: 455

Dropbox Sync API to upload file

I am trying to upload a file to Dropbox using Sync API, but while uploading getting Error

 W/libDropboxSync.so(status): REQUEST: api_core.cpp:264: HTTP request error 400: v1_retired [dc166c5befd76df2]
W/com.dropbox.sync.android.DbxAccount: Failed to update account info.
com.dropbox.sync.android.DbxException$Request: _jobject* dropboxsync::Java_com_dropbox_sync_android_NativeApp_nativeGetAccountInfo(JNIEnv*, jobject, jlong, jobject) - Invalid server request: HTTP request error 400: v1_retired [dc166c5befd76df2]
at com.dropbox.sync.android.DbxError.exceptionFrom(DbxError.java:296)
 at com.dropbox.sync.android.NativeLib.exceptionFrom(NativeLib.java:254)
        at com.dropbox.sync.android.NativeLib.throwFrom(NativeLib.java:242)
        at com.dropbox.sync.android.NativeApp.nativeGetAccountInfo(Native Method)
        at com.dropbox.sync.android.NativeApp.getAccountInfo(NativeApp.java:175)
        at com.dropbox.sync.android.DbxAccount.fetchAccountInfo(DbxAccount.java:559)
        at com.dropbox.sync.android.DbxAccount.backgroundUpdateAccountInfo(DbxAccount.java:540)
        at com.dropbox.sync.android.CoreBackgroundProcessor$RunAccountInfoUpdate.attemptRun(CoreBackgroundProcessor.java:209)
        at com.dropbox.sync.android.CoreBackgroundProcessor$BackgroundRunner.run(CoreBackgroundProcessor.java:239)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

Below Code, I am using for file uploading. Stuck in this from 2 days.

DbxFileSystem dbxFs = DbxFileSystem.forAccount(HomeActivity.mDbxAcctMgr.getLinkedAccount());
DbxPath path = new DbxPath(recordingData.filePath);
DbxFile mFile;
try {
    mFile = dbxFs.open(path);
} catch (DbxException.NotFound e) {
    mFile = dbxFs.create(path);
}
mFile.addListener(mChangeListener);

Upvotes: 0

Views: 269

Answers (1)

Greg
Greg

Reputation: 16930

The SDK you're trying to use is built on Dropbox API v1, which is retired: https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/

You should instead switch to API v2: https://www.dropbox.com/developers

To use API v2 from Java/Android, we recommend using the official Dropbox API v2 Java SDK: https://github.com/dropbox/dropbox-sdk-java

Upvotes: 1

Related Questions