我想使用新的APIv2將保存的csv文件上傳到Dropbox,但它無法正常工作。我正在使用兩個按鈕。 First Button具有用於驗證的OnClick方法「dropbox」,並且其工作正常。但第二個OnClick方法「上傳」不起作用。我不確定「配置」和參數是什麼。需要你的幫助。這是代碼。Android使用APIv2將文件上傳到保管箱
public void dropbox(View view) {
Auth.startOAuth2Authentication(MainActivity.this, APP_KEY);
}
public void uploadfile(View view){
DbxClientV2 client;
DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("examples-v2-demo")
.withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient()))
.build();
client = new DbxClientV2(requestConfig, ACCESS_TOKEN);
try {
File file = new File(getExternalFilesDir(null), "u1u2u.csv");
FileInputStream in = new FileInputStream(file);
FileMetadata metadata = client.files().uploadBuilder("/u1u2u.csv")
.uploadAndFinish(in);
}
catch(DbxException | IOException e){
}
}
我嘗試這個代碼,請從Github上的Dropbox文件,但是當我運行這個它讓我2個錯誤。
錯誤:(1503,93)錯誤:無法訪問okhttp3.OkHttpClient OkHttpClient 類文件未找到 錯誤:執行失敗的任務 ':應用程序:compileDebugJavaWithJavac'。
Compilation failed; see the compiler error output for details.
什麼是錯誤?你可以發佈日誌嗎? – dhiku