BarcodeScanner icon indicating copy to clipboard operation
BarcodeScanner copied to clipboard

App is stopped

Open kishore415 opened this issue 11 years ago • 3 comments

Hi,

My app is being stopped after the barcode is scanned, after scanning it is beeping and closing my app saying "unfortunately app has stopped"

here it the log..

06-30 12:26:02.108: E/AndroidRuntime(27266): FATAL EXCEPTION: main 06-30 12:26:02.108: E/AndroidRuntime(27266): java.lang.RuntimeException: Unable to resume activity {com.misjuba.misjuba/com.misjuba.misjuba.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=195543262, result=-1, data=Intent { act=com.phonegap.plugins.barcodescanner.SCAN flg=0x80000 (has extras) }} to activity {com.misjuba.misjuba/com.misjuba.misjuba.MainActivity}: java.lang.NullPointerException 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2793) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2822) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3743) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.access$700(ActivityThread.java:144) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.os.Handler.dispatchMessage(Handler.java:99) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.os.Looper.loop(Looper.java:137) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.main(ActivityThread.java:5136) 06-30 12:26:02.108: E/AndroidRuntime(27266): at java.lang.reflect.Method.invokeNative(Native Method) 06-30 12:26:02.108: E/AndroidRuntime(27266): at java.lang.reflect.Method.invoke(Method.java:525) 06-30 12:26:02.108: E/AndroidRuntime(27266): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 06-30 12:26:02.108: E/AndroidRuntime(27266): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 06-30 12:26:02.108: E/AndroidRuntime(27266): at dalvik.system.NativeStart.main(Native Method) 06-30 12:26:02.108: E/AndroidRuntime(27266): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=195543262, result=-1, data=Intent { act=com.phonegap.plugins.barcodescanner.SCAN flg=0x80000 (has extras) }} to activity {com.misjuba.misjuba/com.misjuba.misjuba.MainActivity}: java.lang.NullPointerException 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.deliverResults(ActivityThread.java:3370) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2780) 06-30 12:26:02.108: E/AndroidRuntime(27266): ... 13 more 06-30 12:26:02.108: E/AndroidRuntime(27266): Caused by: java.lang.NullPointerException 06-30 12:26:02.108: E/AndroidRuntime(27266): at org.apache.cordova.DroidGap.onActivityResult(DroidGap.java:850) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.Activity.dispatchActivityResult(Activity.java:5322) 06-30 12:26:02.108: E/AndroidRuntime(27266): at android.app.ActivityThread.deliverResults(ActivityThread.java:3366)

kishore415 avatar Jun 30 '14 06:06 kishore415

hi there. i'm experiencing the same issue. anyone have a clue about this one ? (tested on Samsung S3)

chrlvclaudiu avatar May 23 '15 19:05 chrlvclaudiu

Also experiencing this issue, although seemingly only on some Android v5 devices (reproduced on Moto G (2nd gen).

This is my stack trace:

08-14 13:03:45.047: E/AndroidRuntime(22086): FATAL EXCEPTION: main 08-14 13:03:45.047: E/AndroidRuntime(22086): Process: amulet.apps.android, PID: 22086 08-14 13:03:45.047: E/AndroidRuntime(22086): java.lang.RuntimeException: Unable to resume activity {amulet.apps.android/amulet.apps.android.MainActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=195543262, result=-1, data=Intent { act=com.phonegap.plugins.barcodescanner.SCAN flg=0x80000 (has extras) }} to activity {amulet.apps.android/amulet.apps.android.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(org.json.JSONObject)' on a null object reference 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2995) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3030) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2393) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3999) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.access$900(ActivityThread.java:148) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.os.Handler.dispatchMessage(Handler.java:102) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.os.Looper.loop(Looper.java:135) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.main(ActivityThread.java:5312) 08-14 13:03:45.047: E/AndroidRuntime(22086): at java.lang.reflect.Method.invoke(Native Method) 08-14 13:03:45.047: E/AndroidRuntime(22086): at java.lang.reflect.Method.invoke(Method.java:372) 08-14 13:03:45.047: E/AndroidRuntime(22086): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901) 08-14 13:03:45.047: E/AndroidRuntime(22086): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696) 08-14 13:03:45.047: E/AndroidRuntime(22086): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=195543262, result=-1, data=Intent { act=com.phonegap.plugins.barcodescanner.SCAN flg=0x80000 (has extras) }} to activity {amulet.apps.android/amulet.apps.android.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(org.json.JSONObject)' on a null object reference 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.deliverResults(ActivityThread.java:3626) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2969) 08-14 13:03:45.047: E/AndroidRuntime(22086): ... 12 more 08-14 13:03:45.047: E/AndroidRuntime(22086): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(org.json.JSONObject)' on a null object reference 08-14 13:03:45.047: E/AndroidRuntime(22086): at com.phonegap.plugins.barcodescanner.BarcodeScanner.onActivityResult(BarcodeScanner.java:139) 08-14 13:03:45.047: E/AndroidRuntime(22086): at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:120) 08-14 13:03:45.047: E/AndroidRuntime(22086): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:320) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.Activity.dispatchActivityResult(Activity.java:6161) 08-14 13:03:45.047: E/AndroidRuntime(22086): at android.app.ActivityThread.deliverResults(ActivityThread.java:3622) 08-14 13:03:45.047: E/AndroidRuntime(22086): ... 13 more

SunHunter avatar Aug 14 '15 11:08 SunHunter

UPDATE: my issue is solved

Also experiencing this issue. Testing on Android 4.2.2 phone. Building in

  • Windows 8.1, Phogap version 5.2.2. (my app is closed with a message "unfortunately app has stopped".)
  • linux 12.10, Cordova version 3.4.0-0.1.3(the same code, but app doesn't throw any message, simply closes down)

After some investigation of LogCat logs i found some clues... (1) Scanner successfully scans qr code and java returns scan result,

/** qr code found. thread 20 is killed <- it seems that it is scanner thread. thread 22,23 still alive!? **/
09-10 14:46:17.915: D/DecodeHandler(13664): Found barcode in 71 ms
09-10 14:46:17.935: D/dalvikvm(13664): GC_FOR_ALLOC freed 124K (984), 28% free 4040K/5600K, paused 14ms, total 14ms
09-10 14:46:17.939: D/CaptureActivityHandler(13664): Got decode succeeded message
09-10 14:46:19.484: I/CameraFramework(13664): handleMessage: 4
09-10 14:46:19.505: D/CaptureActivityHandler(13664): Got return scan result message
09-10 14:46:19.753: D/dalvikvm(13664): threadid=20: exiting
09-10 14:46:19.753: D/dalvikvm(13664): threadid=20: bye!
09-10 14:46:19.755: D/Camera-JNI(13664): (tid:13664)[native_release] + context=0x60397c18 camera=0x60397888 
09-10 14:46:19.755: D/Camera-JNI(13664): [native_release] context->getStrongCount(2) camera->getStrongCount(2) 
09-10 14:46:19.776: D/Camera-JNI(13664): (tid:13664)[native_release] - context=0x60397c18 camera=0x0 
09-10 14:46:19.776: D/Camera-JNI(13664): (tid:13664)[release camera] - X context=0x60397c18 
09-10 14:46:19.776: D/IPCThreadState(13664): [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x60397b18

(2) however CallbackContext is missing, because WebView gets killed [after trying to open unknown blank page]:

09-10 14:46:06.676: V/webcore(13664): 230 arg1=1 arg2=0 obj=null
09-10 14:46:06.686: V/webcore(13664): LOAD_URL arg1=0 arg2=0 obj=android.webkit.WebViewCore$GetUrlData@41a81590
09-10 14:46:06.686: V/webcore(13664):  CORE loadUrl about:blank 
09-10 14:46:06.686: D/webkit/BrowserFrame(13664): browser frame loadUrl: about:blank
09-10 14:46:06.687: W/ResourceType(13664): No package identifier when getting name for resource number 0x00000064
09-10 14:46:06.687: I/webkit/webview_proxy(13664): Webview.destroy() this=org.apache.cordova.engine.SystemWebView{41a90f38 VFEDH.CL .F...... 0,0-720,1280 #64}

/** it seems that it is the reason why CallbackContext becames missing  **/ 
/** when scan result is returned there is a new webview and CallbackContext value is unknown **/
09-10 14:46:06.687: E/webview(13664): Error: WebView.destroy() called while still attached!

Finally, WebView were recreated after releasing camera and java tries to return result, which it has received:

/** qr code were scanned successfully -> result is correct, but callbackContext is null, now <- seems that is were flushed **/
09-10 14:46:19.848: D/CordovaInterfaceImpl(13664): Sending activity result to plugin
09-10 14:46:19.849: D/BarcodeScanner(13664): {"cancelled":false,"text":"http:\/\/www.joshmorony.com\/","format":"QR_CODE"}null
09-10 14:46:19.850: D/dalvikvm(13664): threadid=20: notify debugger
09-10 14:46:19.850: D/dalvikvm(13664): threadid=20 (pool-2-thread-1): calling run()

09-10 14:46:19.850: D/JsMessageQueue(13664): Dropping Native->JS message due to disabled bridge

And here we see that callbackContext is null and we know why. But i don't know how to repair that. Hope someone will solve this very soon. Full log at pastebin

rusak47 avatar Sep 10 '15 13:09 rusak47