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
380 stars 499 forks source link

Error and crash on Success or on Cancel #88

Open EArminjon opened 4 years ago

EArminjon commented 4 years ago

Describe the bug App print lot of error (java) in console when scan start. On success or on cancel, app crash.

To Reproduce Steps to reproduce the behavior:

RaisedButton(
  onPressed: () async {
    String barcodeScanRes = await FlutterBarcodeScanner.scanBarcode("#ff1100", "Cancel", false, ScanMode.QR);
  },
  child: Text("scan"),
),

Expected behavior It must not crash :')

Screenshots


W/art     ( 5282): Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
I/art     ( 5282): Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
I/art     ( 5282):   at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2436)
I/art     ( 5282):   at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:779)
I/art     ( 5282):   at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:659)
I/art     ( 5282):   at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:552)
I/art     ( 5282):   at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:161)
I/art     ( 5282):   at void com.amolg.flutterbarcodescanner.BarcodeCaptureActivity.onCreate(android.os.Bundle) (BarcodeCaptureActivity.java:109)
I/art     ( 5282):   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
I/art     ( 5282):   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
I/art     ( 5282):   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
I/art     ( 5282):   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
I/art     ( 5282):   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
I/art     ( 5282):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
I/art     ( 5282):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
I/art     ( 5282):   at void android.os.Looper.loop() (Looper.java:154)
I/art     ( 5282):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
I/art     ( 5282):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/art     ( 5282):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
I/art     ( 5282):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
I/art     ( 5282): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/net.beyondgravity.enterprises-1/base.apk"],nativeLibraryDirectories=[/data/app/net.beyondgravity.enterprises-1/lib/x86, /data/app/net.beyondgravity.enterprises-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
I/art     ( 5282):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
I/art     ( 5282):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
I/art     ( 5282):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/art     ( 5282):   at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2436)
I/art     ( 5282):   at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:779)
I/art     ( 5282):   at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:659)
I/art     ( 5282):   at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:552)
I/art     ( 5282):   at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:161)
I/art     ( 5282):   at void com.amolg.flutterbarcodescanner.BarcodeCaptureActivity.onCreate(android.os.Bundle) (BarcodeCaptureActivity.java:109)
I/art     ( 5282):   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
I/art     ( 5282):   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
I/art     ( 5282):   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
I/art     ( 5282):   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
I/art     ( 5282):   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
I/art     ( 5282):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
I/art     ( 5282):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
I/art     ( 5282):   at void android.os.Looper.loop() (Looper.java:154)
I/art     ( 5282):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
I/art     ( 5282):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
I/art     ( 5282):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
I/art     ( 5282):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
I/art     ( 5282): 
W/DynamiteModule( 5282): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found.
I/DynamiteModule( 5282): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0
D/BarcodeNativeHandle( 5282): Cannot load feature, fall back to load dynamite module.
W/DynamiteModule( 5282): Local module descriptor class for com.google.android.gms.vision.dynamite not found.
I/DynamiteModule( 5282): Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:2501
I/DynamiteModule( 5282): Selected remote version of com.google.android.gms.vision.dynamite, version >= 2501
V/DynamiteModule( 5282): Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/System  ( 5282): ClassLoader referenced unknown path: 
W/System  ( 5282): ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
W/System  ( 5282): ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000003/n/x86
W/System  ( 5282): ClassLoader referenced unknown path: /system/priv-app/PrebuiltGmsCore/lib/x86
I/Vision  ( 5282): Loading library libbarhopper.so
W/linker  ( 5282): /data/data/com.google.android.gms/app_vision/barcode/libs/x86/libbarhopper.so: unused DT entry: type 0x7ffffffd arg 0x73c
I/Vision  ( 5282): libbarhopper.so library load status: true
I/DynamiteModule( 5282): Considering local module com.google.android.gms.flags:3 and remote module com.google.android.gms.flags:3
I/DynamiteModule( 5282): Selected local version of com.google.android.gms.flags
I/art     ( 5282): Background partial concurrent mark sweep GC freed 534(23KB) AllocSpace objects, 0(0B) LOS objects, 30% free, 9MB/13MB, paused 182us total 173.419ms
D/EGL_emulation( 5282): eglMakeCurrent: 0xa5755180: ver 2 0 (tinfo 0x948135f0)
D/Camera  ( 5282): app passed NULL surface
D/AndroidRuntime( 5282): Shutting down VM
E/AndroidRuntime( 5282): FATAL EXCEPTION: main
E/AndroidRuntime( 5282): Process: net.beyondgravity.enterprises, PID: 5282
E/AndroidRuntime( 5282): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=0, data=Intent { (has extras) }} to activity {net.beyondgravity.enterprises/net.beyondgravity.enterprises.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( 5282):    at android.app.ActivityThread.deliverResults(ActivityThread.java:4053)
E/AndroidRuntime( 5282):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4096)
E/AndroidRuntime( 5282):    at android.app.ActivityThread.-wrap20(ActivityThread.java)
E/AndroidRuntime( 5282):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1516)
E/AndroidRuntime( 5282):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 5282):    at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime( 5282):    at android.app.ActivityThread.main(ActivityThread.java:6077)
E/AndroidRuntime( 5282):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 5282):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime( 5282):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
E/AndroidRuntime( 5282): 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( 5282):    at com.amolg.flutterbarcodescanner.FlutterBarcodeScannerPlugin.onActivityResult(FlutterBarcodeScannerPlugin.java:157)
E/AndroidRuntime( 5282):    at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEnginePluginRegistry.java:634)
E/AndroidRuntime( 5282):    at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult(FlutterEnginePluginRegistry.java:367)
E/AndroidRuntime( 5282):    at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:546)
E/AndroidRuntime( 5282):    at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:594)
E/AndroidRuntime( 5282):    at android.app.Activity.dispatchActivityResult(Activity.java:6915)
E/AndroidRuntime( 5282):    at android.app.ActivityThread.deliverResults(ActivityThread.java:4049)
E/AndroidRuntime( 5282):    ... 9 more
``

**Smartphone **
- Android emulator, custom (tablet) like : 800x1280 mdpi API 24 Android 7.0 x86
- Flutter channel stable : v1.12.13+hotfix.9
- flutter_barcode_scanner: ^1.0.0
Anzell commented 4 years ago

Yes, same with me. But the Stream works fine =S

psycura commented 4 years ago

I have issue with Stream on ios:

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file

/Users/eugenealitz/.pub-cache/git/flutter_barcode_scanner-cbc5b51f8503bc8fe78119bab5d6c6215f41e8cb/ios/Classes/SwiftFlutterBarcodeScannerPlugin.swift, line 55 2020-05-05 12:21:37.115513+0300 Runner[707:208642] Fatal error: Unexpectedly found nil while unwrapping an Optional value: file /Users/eugenealitz/.pub-cache/git/flutter_barcode_scanner-cbc5b51f8503bc8fe78119bab5d6c6215f41e8cb/ios/Classes/SwiftFlutterBarcodeScannerPlugin.swift, line 55

AmolGangadhare commented 3 years ago

Please check with the latest V 2.0.0