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
385 stars 516 forks source link

can not scan #312

Open MohammadAIProgramer opened 1 year ago

MohammadAIProgramer commented 1 year ago

Just add package, import it, use example code.

class _MyApp extends State { late String barcodeScanRes = "-0-"; @override Widget build(BuildContext context) { return Material( color: Colors.transparent, child: GestureDetector( onTap: () async { String scanBarcode = await FlutterBarcodeScanner.scanBarcode( "#ff6666", "CANCEL", true, ScanMode.BARCODE); setState(() { barcodeScanRes += scanBarcode; }); }, child: SizedBox.expand( child: ColoredBox( color: Colors.blue, child: Container( margin: const EdgeInsets.all(100), //child: SvgPicture.string(svgString, semanticsLabel: 'Acme Logo'), child: Text( barcodeScanRes, textDirection: TextDirection.ltr, ), ), ), ), ), ); } } It takes long time, but not scanning. Console errors. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. An Observatory debugger and profiler on SM A015F is available at: http://127.0.0.1:50250/sw90DF9sT3Y=/ The Flutter DevTools debugger and profiler on SM A015F is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:50250/sw90DF9sT3Y=/ W/Gralloc3(22225): mapper 3.x is not supported D/ViewRootImpl@1062b9bMainActivity: ViewPostIme pointer 0 D/ViewRootImpl@1062b9bMainActivity: ViewPostIme pointer 1 W/ActivityThread(22225): handleWindowVisibility: no activity for token android.os.BinderProxy@da6c1d6 D/PhoneWindow(22225): forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4238 com.android.internal.policy.DecorView.updateColorViews:1488 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3216 android.view.Window.setFlags:1148 com.android.internal.policy.PhoneWindow.generateLayout:2444 I/MultiWindowDecorSupport(22225): updateCaptionType >> DecorView@fa2516b[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true D/MultiWindowDecorSupport(22225): setCaptionType = 0, DecorView = DecorView@fa2516b[] W/scanner_projec(22225): Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) W/scanner_projec(22225): Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) D/ViewRootImpl@39485caBarcodeCaptureActivity: setView = com.android.internal.policy.DecorView@fa2516b TM=true MM=false D/ViewRootImpl@1062b9bMainActivity: MSG_WINDOW_FOCUS_CHANGED 0 1 D/InputMethodManager(22225): prepareNavigationBarInfo() DecorView@515a5d9[MainActivity] D/InputMethodManager(22225): getNavigationBarColor() -855310 D/SurfaceView(22225): onWindowVisibilityChanged(0) true android.view.SurfaceView{4e917b1 V.E...... ......I. 0,0-0,0} of ViewRootImpl@39485ca[BarcodeCaptureActivity] D/ViewRootImpl@39485caBarcodeCaptureActivity: Relayout returned: old=(0,0,720,1520) new=(0,0,720,1520) req=(720,1520)0 dur=12 res=0x7 s={true 3208865792} ch=true D/OpenGLRenderer(22225): createReliableSurface : 0xbf5cdfc0, 0xbf436800 D/SurfaceView(22225): surfaceCreated 1 #8 android.view.SurfaceView{4e917b1 V.E...... ......ID 0,0-720,1245} D/SurfaceView(22225): surfaceChanged (720,1245) 1 #8 android.view.SurfaceView{4e917b1 V.E...... ......ID 0,0-720,1245} D/ViewRootImpl@39485caBarcodeCaptureActivity: Relayout returned: old=(0,0,720,1520) new=(0,0,720,1520) req=(720,1520)0 dur=16 res=0x1 s={true 3208865792} ch=false D/ViewRootImpl@39485caBarcodeCaptureActivity: MSG_RESIZED: frame=(0,0,720,1520) ci=(0,59,0,96) vi=(0,59,0,96) or=1 D/InputTransport(22225): Input channel destroyed: 'ClientS', fd=80 D/ViewRootImpl@1062b9bMainActivity: stopped(true) old=false D/SurfaceView(22225): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{50704b9 V.E...... ........ 0,0-720,1424} of ViewRootImpl@1062b9b[MainActivity] D/SurfaceView(22225): surfaceDestroyed callback.size 1 #1 io.flutter.embedding.android.FlutterSurfaceView{50704b9 V.E...... ........ 0,0-720,1424} D/SurfaceView(22225): remove() io.flutter.embedding.android.FlutterSurfaceView{50704b9 V.E...... ........ 0,0-720,1424} Surface(name=SurfaceView - bar.com.barcode_scanner_project/bar.com.barcode_scanner_project.MainActivity@50704b9@0)/@0x8c67ded D/SurfaceView(22225): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{50704b9 G.E...... ......I. 0,0-720,1424} of ViewRootImpl@1062b9b[MainActivity] D/ViewRootImpl@1062b9bMainActivity: Relayout returned: old=(0,0,720,1520) new=(0,0,720,1520) req=(720,1520)8 dur=11 res=0x5 s={false 0} ch=false W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/BarcodeNativeHandle(22225): Native handle not yet available. Reverting to no-op handle. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. D/ViewRootImpl@39485caBarcodeCaptureActivity: stopped(false) old=false I/Choreographer(22225): Skipped 67 frames! The application may be doing too much work on its main thread. D/ViewRootImpl@39485caBarcodeCaptureActivity: Relayout returned: old=(0,0,720,1520) new=(0,0,720,1520) req=(720,1520)0 dur=8 res=0x1 s={true 3208865792} ch=false D/ViewRootImpl@39485caBarcodeCaptureActivity: MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(22225): prepareNavigationBarInfo() DecorView@fa2516b[BarcodeCaptureActivity] D/InputMethodManager(22225): getNavigationBarColor() -855310 D/InputMethodManager(22225): prepareNavigationBarInfo() DecorView@fa2516b[BarcodeCaptureActivity] D/InputMethodManager(22225): getNavigationBarColor() -855310 V/InputMethodManager(22225): Starting input: tba=bar.com.barcode_scanner_project ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(22225): startInputInner - Id : 0 I/InputMethodManager(22225): startInputInner - mService.startInputOrWindowGainedFocus W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:0 E/Vision (22225): Error loading optional module com.google.android.gms.vision.barcode: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0. W/DynamiteModule(22225): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(22225): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0

cezaryjk commented 1 year ago

Hi, I had the same issue even on Android 11. It turned out "Google Play Services" package was missing. Last available package requires Android 8...

Good luck! Cezary