We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

Forum Discussion

Hongbin L.'s avatar
Hongbin L.
New member | Level 1
9 years ago

Android SDK crash

Hi. I have implemented Dropbox API in my android app.
After released the app to public, I got a number of crash report from the Dropbox SDK. No sure what is the root cause.
 
The issue seems to happen on a varieties of devices. Please help! Thank you so much.

 
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getPath()' on a null object reference
at com.dropbox.client2.android.AuthActivity.onNewIntent(Unknown Source)
at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1218)
at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1230)
at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2683)
at android.app.ActivityThread.performNewIntents(ActivityThread.java:2695)
at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2704)
at android.app.ActivityThread.access$1600(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1542)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5643)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
  • Steve M.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff

    Could you tell us what version of what SDK you're using?

    I think based on the stack that you're using some version of the Core API (v1) Android SDK, but it would help to know exactly which version.

    In the current code for onNewIntent, this is the only call I see to getPath(), which sure looks like it's guarded against null pointer exceptions.

     } else {
        // Web auth.
        Uri uri = intent.getData();
        if (uri != null) {
            String path = uri.getPath();

    One quick way to check which version you're using is to look at SdkVersion.java.

    EDIT: If using a JAR file, the version number should be in the name of the file.

  • Steve M.'s avatar
    Steve M.
    Icon for Dropbox Staff rankDropbox Staff

    Hmm. The code in that version looks identical, and there are no other calls to getPath().

    Is there any chance you modified the code in AuthActivity.java? I'm afraid I don't have any other ideas.

About Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,875 PostsLatest Activity: 2 hours ago
323 Following

If 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!