You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
kmsbs
7 years agoExplorer | Level 4
what should be a file download path
what is the correct download path :
mDbxClient.files().download(Path =?);
mDbxClient.files().download("https://www.dropbox.com/home/Apps/AndroidDbAppStorage") .downloa...
kmsbs
Explorer | Level 4
kmsbs
7 years agoExplorer | Level 4
output:
java.lang.NullPointerException: Attempt to invoke virtual method 'long java.io.File.length()' on a null object reference
at line :
protected void onPostExecute(File result) {
super.onPostExecute(result);
if (result.length()!=0) {
Toast.makeText(mContext, "File downloaded", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(mContext, LoginActivity.class);
mContext.startActivity(intent);
} else {
}
}
java.lang.NullPointerException: Attempt to invoke virtual method 'long java.io.File.length()' on a null object reference
at line :
protected void onPostExecute(File result) {
super.onPostExecute(result);
if (result.length()!=0) {
Toast.makeText(mContext, "File downloaded", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(mContext, LoginActivity.class);
mContext.startActivity(intent);
} else {
}
}
- Greg-DB7 years agoDropbox Staff
Thanks for sharing that error output! That shows that you're getting a 'NullPointerException' for the 'File result' in your 'onPostExecute'. That is, the object itself is null, which is not the same as saying the downloaded file has zero length.
You'll need to investigate why your code isn't actually returning the 'file' object. I suspect it's because something is going wrong with the downloading or writing of the file, but, upon closer inspection of your code, it seems you're not seeing it because you're silently throwing away potential exceptions here:
} catch (DbxException | IOException e) { }
You should add error handling there to take handle any issues that may arise (e.g., if you don't have permission to write to the local file path you specified, etc.).
- kmsbs7 years agoExplorer | Level 4
this is the error :
com.dropbox.core.v2.files.DownloadErrorException: Exception in 2/files/download: {".tag":"path","path":"not_found"}
- Greg-DB7 years agoDropbox Staff
kmsbs Please don't post the same question in multiple places. It makes it harder to keep track of your question(s), and can cause spam for other people on older threads.
I see you also posted a new thread for this, so I'll follow up there:
https://www.dropboxforum.com/t5/API-Support-Feedback/path-not-found-error/m-p/284453#M17409
About Discuss Dropbox Developer & API
Make connections with other developers
797 PostsLatest Activity: 6 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!