Dropbox Sync API上传文件

时间:2019-03-11 12:11:58

标签: android dropbox-api dropbox-sdk

我正在尝试使用Sync API将文件上传到Dropbox,但是在上传时出现错误

getReturnByOrderId(value) {
  if (value.length > 0) {
    this.rest.getOrder(value).subscribe((data: {}) => {
      if (Object.entries(data).length !== 0) {
        this.openDialog(data);
      } else {
         // if data is empty show 
        this.inputForm.setErrors({ 'invalid': true });
      }
    }, error => {
        //when 404 error 
        this.inputForm.setErrors({ 'invalid': true });

    });
  } else {
    this.rest.getReturns().subscribe((data: {}) => {
      this.returns = data;
    });
  }
}

以下代码,我正在用于文件上传。从2天开始停留在此。

 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)

1 个答案:

答案 0 :(得分:0)

您要使用的SDK是基于Dropbox API v1构建的,该版本已淘汰:https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/

您应该改用API v2:https://www.dropbox.com/developers

要使用Java / Android中的API v2,我们建议使用官方的Dropbox API v2 Java SDK:https://github.com/dropbox/dropbox-sdk-java