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

Black screen and app crash on Android 9 Flutter 1.20 #120

Open JamesBewley opened 4 years ago

JamesBewley commented 4 years ago

Describe the bug Once the barcode scanner is launched only a black screen is displayed. Pressing anywhere on the black screen results in a null pointer exception and the app crashes.

To Reproduce Steps to reproduce the behavior:

  1. Launch the barcode scanner.
  2. Press the black screen.

Expected behavior Barcode scanning screen and no crash.

Smartphone (please complete the following information):

JamesBewley commented 4 years ago

The following exception is being thrown in the onCreate method but isn't being handled

E/BCActivity:onCreate(): onCreate: Binary XML file line #15: Binary XML file line #15: Error inflating class com.amolg.flutterbarcodescanner.camera.GraphicOverlay

JamesBewley commented 4 years ago

Giving up and using the barcode_scan wrapper

https://pub.dev/packages/barcode_scan

RangerOfGondor commented 3 years ago

For anyone else that faced the same issue, the problem is because of an invalid string in the HEX COLOR property of scanBarcode() function.

To rectify it, try this code given in the example: barcodeScanRes = await FlutterBarcodeScanner.scanBarcode( '#ff6666', 'Cancel', true, ScanMode.BARCODE);

scfabricio commented 3 years ago

@RangerOfGondor I was having the same problem. I used your tip and it worked correctly. Thank you.

AmolGangadhare commented 3 years ago

Please check with the latest V 2.0.0 if the issue still persists?

ali-kara commented 2 years ago

For anyone else that faced the same issue, the problem is because of an invalid string in the HEX COLOR property of scanBarcode() function.

To rectify it, try this code given in the example: barcodeScanRes = await FlutterBarcodeScanner.scanBarcode( '#ff6666', 'Cancel', true, ScanMode.BARCODE);

That was solved my problem. Thanks