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
382 stars 507 forks source link

Unable to run the scanner on Android #274

Closed lahirunc closed 2 years ago

lahirunc commented 2 years ago

Describe the bug Empty Black screen but in iOS both QR and Barcode is read without an issue using below code.

To Reproduce onPressed event inside an elevated button

String barcodeScanRes =
                      await FlutterBarcodeScanner.scanBarcode('FF000000',
                          'Cancel', true, ScanMode.DEFAULT);

Screenshots IMG_0030

Smartphone (please complete the following information):

Additional context

W[/.gnau_store_ap]()(12774): Accessing hidden method Landroid[/view/View]();->computeFitSystemWindows(Landroid[/graphics/Rect]();Landroid[/graphics/Rect]();)Z (unsupported, reflection, allowed)
W[/.gnau_store_ap]()(12774): Accessing hidden method Landroid[/view/ViewGroup]();->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
E[/InputEventReceiver]()(12774): Exception dispatching input event.
E[/MessageQueue-JNI]()(12774): Exception in MessageQueue callback: handleReceiveCallback
E[/MessageQueue-JNI]()(12774): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.ScaleGestureDetector.onTouchEvent(android.view.MotionEvent)' on a null object reference
E[/MessageQueue-JNI]()(12774):  at com.amolg.flutterbarcodescanner.BarcodeCaptureActivity.onTouchEvent(BarcodeCaptureActivity.java:187)
E[/MessageQueue-JNI]()(12774):  at android.app.Activity.dispatchTouchEvent(Activity.java:4199)
E[/MessageQueue-JNI]()(12774):  at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
E[/MessageQueue-JNI]()(12774):  at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:460)
E[/MessageQueue-JNI]()(12774):  at android.view.View.dispatchPointerEvent(View.java:14799)
E[/MessageQueue-JNI]()(12774):  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6344)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6145)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5623)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5680)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5646)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5811)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5654)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5868)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5627)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5680)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5646)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5654)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5627)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8558)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8509)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8478)
E/MessageQueue-JNI(12774):  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8681)
E/MessageQueue-JNI(12774):  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:259)
E/MessageQueue-JNI(12774):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/MessageQueue-JNI(12774):  at android.os.MessageQueue.next(MessageQueue.java:335)
E/MessageQueue-JNI(12774):  at android.os.Looper.loopOnce(Looper.java:161)
E/MessageQueue-JNI(12774):  at android.os.Looper.loop(Looper.java:288)
E/MessageQueue-JNI(12774):  at android.app.ActivityThread.main(ActivityThread.java:7842)
E/MessageQueue-JNI(12774):  at java.lang.reflect.Method.invoke(Native Method)
E/MessageQueue-JNI(12774):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MessageQueue-JNI(12774):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
D/AndroidRuntime(12774): Shutting down VM
E/AndroidRuntime(12774): FATAL EXCEPTION: main
E/AndroidRuntime(12774): Process: com.gimmenow.gnau_store_app, PID: 12774
E/AndroidRuntime(12774): java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.ScaleGestureDetector.onTouchEvent(android.view.MotionEvent)' on a null object reference
E/AndroidRuntime(12774):    at com.amolg.flutterbarcodescanner.BarcodeCaptureActivity.onTouchEvent(BarcodeCaptureActivity.java:187)
E/AndroidRuntime(12774):    at android.app.Activity.dispatchTouchEvent(Activity.java:4199)
E/AndroidRuntime(12774):    at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
E/AndroidRuntime(12774):    at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:460)
E/AndroidRuntime(12774):    at android.view.View.dispatchPointerEvent(View.java:14799)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6344)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6145)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5623)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5680)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5646)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5811)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5654)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5868)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5627)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5680)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5646)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5654)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5627)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8558)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8509)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8478)
E/AndroidRuntime(12774):    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8681)
E/AndroidRuntime(12774):    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:259)
E/AndroidRuntime(12774):    at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(12774):    at android.os.MessageQueue.next(MessageQueue.java:335)
E/AndroidRuntime(12774):    at android.os.Looper.loopOnce(Looper.java:161)
E/AndroidRuntime(12774):    at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(12774):    at android.app.ActivityThread.main(ActivityThread.java:7842)
E/AndroidRuntime(12774):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(12774):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(12774):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
I/Process (12774): Sending signal. PID: 12774 SIG: 9
Lost connection to device.
justjew commented 2 years ago

Add # to color

FF0000

lahirunc commented 2 years ago

This worked! Thanks