我已经完成了一个 android 应用程序并将 DropBox 集成到我的应用程序以上传数据库。当我上传单个文件时,它将正确上传。我的问题是当我从我的应用程序获取 db 文件并将其上传到保管箱时它显示文件未找到异常。我也在使用此链接,但未获得解决方案。 关联
FileInputStream inputStream = null;
try {
String databasePath=getDatabasePath("databaseTaskApps.db").getPath();
Log.i(TAG,"DatabasePath:"+databasePath);
File file = new File(databasePath+ "/databaseTaskApps");
inputStream = new FileInputStream(file);
com.dropbox.client2.DropboxAPI.Entry newEntry = mApi.putFileOverwrite("/databaseTaskApps", inputStream,
file.length(), null);
Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
} catch (DropboxUnlinkedException e) {
// User has unlinked, ask them to link again here.
Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
} catch (DropboxException e) {
Log.e("DbExampleLog", "Something went wrong while uploading.");
Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
} catch (FileNotFoundException e) {
Log.e("DbExampleLog", "File not found.");
Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
}
}
}