Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11446

Android: app crashes after taking a photo

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 5.4.1
    • None
    • cordova-plugin-camera
    • Smartphone: Samsung Galaxy S5 Active
      Model: SM-G870F
      Android version: 5.0

    Description

      I develop with a framework using cordova for an hybrid application.
      I only produce the Android version for testing the application.

      I'm using cordova-plugin-camera 2.2.0 to take a picture in my application.
      I use getPicture method to do that.

      I always encounter this bug by following these steps :

      • Take a photo
      • Tap the "Retry" button
      • Take another photo
      • Then validate the photo by tapping the "Ok" button OR by cancelling with the back button
      • ==> App stopped

      I try to debug with Android Studio but even with breakpoints I don't succeed.

      Bellow, the stack from the Java Error when validating the photo:

      E/AndroidRuntime: FATAL EXCEPTION: main
      Process: my.application.appXXX.bip.mobileClient, PID: 16960
      java.lang.RuntimeException: Unable to resume activity {my.application.appXXX.bip.mobileClient/my.application.appXXX.bip.mobileClient.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=-1, data=null} to activity {my.application.appXXX.bip.mobileClient/my.application.appXXX.bip.mobileClient.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference
          at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3349)
          at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3380)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2731)
          at android.app.ActivityThread.access$900(ActivityThread.java:172)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:145)
          at android.app.ActivityThread.main(ActivityThread.java:5835)
          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:1388)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
       Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=-1, data=null} to activity {my.application.appXXX.bip.mobileClient/my.application.appXXX.bip.mobileClient.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference
          at android.app.ActivityThread.deliverResults(ActivityThread.java:3977)
          at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3335)
          at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3380) 
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2731) 
          at android.app.ActivityThread.access$900(ActivityThread.java:172) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) 
          at android.os.Handler.dispatchMessage(Handler.java:102) 
          at android.os.Looper.loop(Looper.java:145) 
          at android.app.ActivityThread.main(ActivityThread.java:5835) 
          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:1388) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183) 
       Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference
          at org.apache.cordova.camera.CameraLauncher.processResultFromCamera(CameraLauncher.java:452)
          at org.apache.cordova.camera.CameraLauncher.onActivityResult(CameraLauncher.java:787)
          at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:120)
          at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:353)
          at android.app.Activity.dispatchActivityResult(Activity.java:6475)
          at android.app.ActivityThread.deliverResults(ActivityThread.java:3973)
          at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3335) 
          at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3380) 
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2731) 
          at android.app.ActivityThread.access$900(ActivityThread.java:172) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) 
          at android.os.Handler.dispatchMessage(Handler.java:102) 
          at android.os.Looper.loop(Looper.java:145) 
          at android.app.ActivityThread.main(ActivityThread.java:5835) 
          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:1388) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183) 
      

      Bellow, the stack from the Java Error when cancelling the application:

      E/AndroidRuntime: FATAL EXCEPTION: main
      Process: my.application.appXXX.bip.mobileClient, PID: 22777
      java.lang.RuntimeException: Unable to resume activity {my.application.appXXX.bip.mobileClient/my.application.appXXX.bip.mobileClient.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=0, data=null} to activity {my.application.appXXX.bip.mobileClient/my.application.appXXX.bip.mobileClient.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.error(java.lang.String)' on a null object reference
          at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3349)
          at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3380)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2731)
          at android.app.ActivityThread.access$900(ActivityThread.java:172)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:145)
          at android.app.ActivityThread.main(ActivityThread.java:5835)
          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:1388)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
       Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=34, result=0, data=null} to activity {my.application.appXXX.bip.mobileClient/my.application.appXXX.bip.mobileClient.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.error(java.lang.String)' on a null object reference
          at android.app.ActivityThread.deliverResults(ActivityThread.java:3977)
          at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3335)
          at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3380) 
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2731) 
          at android.app.ActivityThread.access$900(ActivityThread.java:172) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) 
          at android.os.Handler.dispatchMessage(Handler.java:102) 
          at android.os.Looper.loop(Looper.java:145) 
          at android.app.ActivityThread.main(ActivityThread.java:5835) 
          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:1388) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183) 
       Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.error(java.lang.String)' on a null object reference
          at org.apache.cordova.camera.CameraLauncher.failPicture(CameraLauncher.java:1190)
          at org.apache.cordova.camera.CameraLauncher.onActivityResult(CameraLauncher.java:797)
          at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:120)
          at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:353)
          at android.app.Activity.dispatchActivityResult(Activity.java:6475)
          at android.app.ActivityThread.deliverResults(ActivityThread.java:3973)
          at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3335) 
          at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3380) 
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2731) 
          at android.app.ActivityThread.access$900(ActivityThread.java:172) 
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421) 
          at android.os.Handler.dispatchMessage(Handler.java:102) 
          at android.os.Looper.loop(Looper.java:145) 
          at android.app.ActivityThread.main(ActivityThread.java:5835) 
          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:1388) 
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183) 
      

      Attachments

        Issue Links

          Activity

            People

              vladimir.kotikov Vladimir Kotikov
              Victor Ros Victor Ros
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: