0

I've been reading a lot and searching on the internet and I have found similar questions but still no answer. So I will try again :)

I'm developing an app with phonegap 2.7 and I'm using the recommended function to upload pictures. The problem is that some users are reporting an exception when trying to select their pictures, and the app is crashing.

Looking at the google play console I can see this error:

  java.lang.RuntimeException: Unable to resume activity 
  {com.xmile.events/com.xmile.events.MainActivity}: java.lang.RuntimeException: Failure 
  delivering result ResultInfo{who=null, request=18, result=-1, data=Intent { 
  dat=content://media/external/images/media/201233 }} to activity 
  {com.xmile.events/com.xmile.events.MainActivity}: java.lang.NullPointerException
  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2444)
  at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2472)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1986)
  at android.app.ActivityThread.access$600(ActivityThread.java:123)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4424)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, 
  request=18, result=-1, data=Intent { dat=content://media/external/images/media/201233 }} 
  to activity {com.xmile.events/com.xmile.events.MainActivity}: 
  java.lang.NullPointerException
  at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
  at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2431)
  ... 12 more
  Caused by: java.lang.NullPointerException
  at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:858)
  at android.app.Activity.dispatchActivityResult(Activity.java:4649)
  at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
  ... 13 more

The function to select the image is this one:

function selectPicture() {
    pictureSource=navigator.camera.PictureSourceType;
    destinationType=navigator.camera.DestinationType;

    // Retrieve image file location from specified source
    navigator.camera.getPicture(
        onPhotoURISuccess, onFail, { quality: 25, 
        destinationType: destinationType.FILE_URI,
        sourceType: pictureSource.PHOTOLIBRARY });
}

So I understand the problem arises when a user selects an image and goes back to the main process... somehow it is dead and then a NPE comes up :'( Even more weird, it only happens to a few users and I can't reproduce it with my mobile.

Any help would be highly appreciated!

David S
  • 16
  • 5
  • HAve you seen this question [here](http://stackoverflow.com/questions/9303701/phonegap-app-quits-after-camera-captures-image-android)? – Amol Chakane Aug 27 '13 at 09:54
  • @AmolChakane Yup. And nothing worked :'( – David S Aug 27 '13 at 13:25
  • What are the device specifications of those users(those who faced this isse)? – Amol Chakane Aug 27 '13 at 13:35
  • I don't know @AmolChakane as google play console doesn't give this info :'( According to Simon MacDonald (from phonegap) it seems that the problem is that Android has killed the app and then after the Intent there is nowhere to go back. But, still, don't know why it only happens on some devices :'( – David S Aug 27 '13 at 13:48
  • Can't you contact those users and get the info? – Amol Chakane Aug 27 '13 at 13:53

1 Answers1

0

I guess you are trying with Android version 4.1 or 4.2. If it's the case so refer to this answer : Phonegap : Upload picture crashes on Samsung mobile 4.1.2 but works fine on Google Nexus 4.3.0

Community
  • 1
  • 1
ghost rider3
  • 448
  • 1
  • 5
  • 17