AmolGangadhare / flutter_barcode_scanner

Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
https://pub.dev/packages/flutter_barcode_scanner
MIT License
379 stars 453 forks source link

App crashes the moment I call `scanBarcode` and touch on the phone #101

Open escamoteur opened 4 years ago

escamoteur commented 4 years ago

After calling scanBarcode the screen of my phone gets dark but I don't get any camera picture. When I tap on the screen it crashes with this output

E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4958)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5011)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4977)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5117)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4985)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5174)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4958)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5011)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4977)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4985)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4958)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7675)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7644)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7605)
E/AndroidRuntime(26105):    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7800)
E/AndroidRuntime(26105):    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
E/AndroidRuntime(26105):    at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(26105):    at android.os.MessageQueue.next(MessageQueue.java:336)
E/AndroidRuntime(26105):    at android.os.Looper.loop(Looper.java:174)
E/AndroidRuntime(26105):    at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime(26105):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(26105):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(26105):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process (26105): Sending signal. PID: 26105 SIG: 9

Smartphone (please complete the following information):

Additional context I'm running on Flutter master.

a side note: you could add to the readme that you have to add Android permissions

ElimuMichael commented 4 years ago

After calling scanBarcode the screen of my phone gets dark but I don't get any camera picture. When I tap on the screen it crashes with this output

E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4958)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5011)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4977)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5117)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4985)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5174)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4958)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5011)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4977)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4985)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4958)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7675)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7644)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7605)
E/AndroidRuntime(26105):  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7800)
E/AndroidRuntime(26105):  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
E/AndroidRuntime(26105):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(26105):  at android.os.MessageQueue.next(MessageQueue.java:336)
E/AndroidRuntime(26105):  at android.os.Looper.loop(Looper.java:174)
E/AndroidRuntime(26105):  at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime(26105):  at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(26105):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(26105):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process (26105): Sending signal. PID: 26105 SIG: 9

Smartphone (please complete the following information):

  • Device: Pixel3a
  • OS: [Android 10]

Additional context I'm running on Flutter master.

a side note: you could add to the readme that you have to add Android permissions

I got the same issue too. Is there any solution for this?

Defuera commented 4 years ago

Same here

AmolGangadhare commented 4 years ago

@escamoteur

Thanks for reporting the issue. The error log seems to be incomplete, can you provide a complete log?

ahmadkhedr commented 3 years ago

app passed NULL surface W/BpBinder(29628): Slow Binder: BpBinder transact took 210ms, interface=android.hardware.ICamera, code=1 oneway=false W/Activity(29628): Slow Operation: Activity com.example.Shopmatica/com.amolg.flutterbarcodescanner.BarcodeCaptureActivity onPause took 376ms W/Looper (29628): Slow Looper main: doFrame is 382ms late because of 3 msg, msg 1 took 394ms (seq=1117 late=19ms h=android.app.ActivityThread$H w=159) E/libc (29628): Access denied finding property "vendor.camera.hal1.packagelist" D/Camera (29628): Lct package name is com.example.Shopmatica E/libc (29628): Access denied finding property "vendor.camera.aux.packagelist" D/Camera (29628): app passed NULL surface W/BpBinder(29628): Slow Binder: BpBinder transact took 267ms, interface=android.hardware.ICamera, code=1 oneway=false W/Activity(29628): Slow Operation: Activity com.example.Shopmatica/com.amolg.flutterbarcodescanner.BarcodeCaptureActivity onPause took 442ms W/Looper (29628): Slow Looper main: doFrame is 456ms late because of 5 msg, msg 1 took 460ms (seq=1167 late=20ms h=android.app.ActivityThread$H w=159) D/AndroidRuntime(29628): Shutting down VM E/AndroidRuntime(29628): FATAL EXCEPTION: main E/AndroidRuntime(29628): Process: com.example.Shopmatica, PID: 29628 E/AndroidRuntime(29628): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=0, data=Intent { (has extras) }} to activity {com.example.Shopmatica/com.example.Shopmatica.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference E/AndroidRuntime(29628): at android.app.ActivityThread.deliverResults(ActivityThread.java:4927) E/AndroidRuntime(29628): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4968) E/AndroidRuntime(29628): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) E/AndroidRuntime(29628): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime(29628): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime(29628): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2043) E/AndroidRuntime(29628): at android.os.Handler.dispatchMessage(Handler.java:107) E/AndroidRuntime(29628): at android.os.Looper.loop(Looper.java:224) E/AndroidRuntime(29628): at android.app.ActivityThread.main(ActivityThread.java:7548) E/AndroidRuntime(29628): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(29628): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) E/AndroidRuntime(29628): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) E/AndroidRuntime(29628): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference E/AndroidRuntime(29628): at com.amolg.flutterbarcodescanner.FlutterBarcodeScannerPlugin.onActivityResult(FlutterBarcodeScannerPlugin.java:157) E/AndroidRuntime(29628): at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEnginePluginRegistry.java:691) E/AndroidRuntime(29628): at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult(FlutterEnginePluginRegistry.java:378) E/AndroidRuntime(29628): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:619) E/AndroidRuntime(29628): at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:584) E/AndroidRuntime(29628): at android.app.Activity.dispatchActivityResult(Activity.java:8249) E/AndroidRuntime(29628): at android.app.ActivityThread.deliverResults(ActivityThread.java:4920) E/AndroidRuntime(29628): ... 11 more I/Process (29628): Sending signal. PID: 29628 SIG: 9 Lost connection to device.

nyck33 commented 2 years ago

on my Alcatel I get the view with red bar going up and down but these errors:

An Observatory debugger and profiler on 5002S is available at: http://127.0.0.1:37591/MeICDxMwGMg=/
The Flutter DevTools debugger and profiler on 5002S is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:37591/MeICDxMwGMg=/
W/ActivityThread( 3010): handleWindowVisibility: no activity for token android.os.BinderProxy@846065c
W/escannerexampl( 3010): Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
W/DynamiteModule( 3010): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found.
I/DynamiteModule( 3010): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0
I/DynamiteModule( 3010): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:1
I/DynamiteModule( 3010): Selected remote version of com.google.android.gms.vision.barcode, version >= 1
V/DynamiteModule( 3010): Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J (greylist,core-platform-api, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->peekLong(JZ)J (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->pokeLong(JJZ)V (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->pokeInt(JIZ)V (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->peekInt(JZ)I (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->pokeByteArray(J[BII)V (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Llibcore/io/Memory;->peekByteArray(J[BII)V (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->arrayBaseOffset(Ljava/lang/Class;)I (greylist,core-platform-api, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->arrayIndexScale(Ljava/lang/Class;)I (greylist, linking, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden field Ljava/nio/Buffer;->address:J (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed)
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed)
E/libc    ( 3010): Access denied finding property "vendor.camera.aux.packagelist"
W/escannerexample( 3010): type=1400 audit(0.0:15958): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=12107 scontext=u:r:untrusted_app:s0:c179,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
W/escannerexample( 3010): type=1400 audit(0.0:15959): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=12107 scontext=u:r:untrusted_app:s0:c179,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
E/libc    ( 3010): Access denied finding property "vendor.camera.aux.packagelist"
W/escannerexample( 3010): type=1400 audit(0.0:15960): avc: denied { read } for name="u:object_r:persist_camera_prop:s0" dev="tmpfs" ino=12107 scontext=u:r:untrusted_app:s0:c179,c256,c512,c768 tcontext=u:object_r:persist_camera_prop:s0 tclass=file permissive=0
E/libc    ( 3010): Access denied finding property "vendor.camera.aux.packagelist"
W/escannerexample( 3010): type=1400 audit(0.0:15961): avc: denied { read } for name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=12157 scontext=u:r:untrusted_app:s0:c179,c256,c512,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
E/libc    ( 3010): Access denied finding property "vendor.camera.hal1.packagelist"
E/libc    ( 3010): Access denied finding property "vendor.camera.aux.packagelist"
I/escannerexampl( 3010): Background young concurrent copying GC freed 6708(641KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 12MB/12MB, paused 136us total 104.850ms
I/escannerexampl( 3010): Background concurrent copying GC freed 540(71KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 12MB/25MB, paused 136us total 159.791ms
W/escannerexampl( 3010): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/escannerexampl( 3010): Background concurrent copying GC freed 96505(3946KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 14MB/28MB, paused 354us total 239.494ms
Lost connection to device.

I shut the app down for the last line.