rmtmckenzie / flutter_qr_mobile_vision

QR reader plugin using mobile vision API for Flutter.
MIT License
215 stars 185 forks source link

flutter: flutter_qr_mobile_vission not working scanning any type of barcode #51

Closed salmanDevj closed 5 years ago

salmanDevj commented 5 years ago

I tried to run and test the plugin project on Samsung Note 2 and app open the camera without any issues howvever, it is not able to read to any barcode.

flutter doctor: C:\Users\Javed\myapp>flutter doctor -v [√] Flutter (Channel master, v0.11.7-pre.34, on Microsoft Windows [Version 10.0.17134.345], locale en-US) • Flutter version 0.11.7-pre.34 at C:\flutter • Framework revision 988bfc166d (25 hours ago), 2018-11-15 18:07:17 -0800 • Engine revision 699f328df5 • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3) • Android SDK at C:\Users\Javed\AppData\Local\Android • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.3 • ANDROID_HOME = C:\Users\Javed\AppData\Local\Android • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02) • All Android licenses accepted.

[√] Android Studio (version 3.1) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 28.0.1 • Dart plugin version 173.4700 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code (version 1.28.1) • VS Code at C:\Users\Javed\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 2.19.0

[√] Connected device (1 available) • GT N7100 • 4df74fc8537b2129 • android-arm • Android 4.4.2 (API 19)

• No issues found!

How am i using it:

import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:qr_mobile_vision/qr_camera.dart';

class FragmentSpecials extends StatefulWidget { @override _MyHomePageState createState() => new _MyHomePageState(); }

class _MyHomePageState extends State { String qr; bool camState = false;

@override initState() { debugPaintSizeEnabled = false; super.initState(); }

@override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('Plugin example app'), ), body: new Center( child: new Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ new Expanded( child: camState ? new Center( child: new SizedBox( width: 300.0, height: 600.0, child: new QrCamera( onError: (context, error) => Text( error.toString(), style: TextStyle(color: Colors.red), ), qrCodeCallback: (code) { setState(() { qr = code; }); }, child: new Container( decoration: new BoxDecoration( color: Colors.transparent, border: Border.all(color: Colors.orange, width: 10.0, style: BorderStyle.solid), ), ), ), ), ) : new Center(child: new Text("Camera inactive"))), new Text("QRCODE: $qr"), ], ), ), floatingActionButton: new FloatingActionButton( child: new Text( "press me", textAlign: TextAlign.center, ), onPressed: () { setState(() { camState = !camState; }); }), ); } }


name: myapp description: A new Flutter project.

version: 1.0.0+1

environment: sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies: flutter: sdk: flutter carousel_pro: ^0.0.13

cupertino_icons: ^0.1.2 shared_preferences: "0.4.2" audioplayers: ^0.7.8 qr_mobile_vision: ^0.1.0

dev_dependencies: flutter_test: sdk: flutter

flutter: uses-material-design: true assets:


log is here:

I/cgr.qrmv.QrReader( 7816): Using old camera API. I/cgr.qrmv.QrDetector( 7816): Making detector for formats: 0 W/DynamiteModule( 7816): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule( 7816): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 D/BarcodeNativeHandle( 7816): Cannot load feature, fall back to load whole module. W/DynamiteModule( 7816): Local module descriptor class for com.google.android.gms.vision.dynamite not found. I/DynamiteModule( 7816): Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:1800 I/DynamiteModule( 7816): Selected remote version of com.google.android.gms.vision.dynamite, version >= 1800 I/Vision ( 7816): Loading library libbarhopper.so I/Vision ( 7816): libbarhopper.so library load status: true I/cgr.qrmv.QrCameraC1( 7816): Initializing with autofocus on. D/dalvikvm( 7816): GC_FOR_ALLOC freed 680K, 32% free 9259K/13548K, paused 36ms, total 36ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.369MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed <1K, 25% free 10271K/13548K, paused 27ms, total 27ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1016K, 32% free 9255K/13548K, paused 18ms, total 18ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 21ms, total 21ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 16ms, total 17ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 22ms, total 22ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 23ms, total 25ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 23ms, total 23ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 18ms, total 19ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 18ms, total 18ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 19ms, total 19ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 23ms, total 23ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 28ms, total 28ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 25ms, total 25ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 18ms, total 18ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 16ms, total 16ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 16ms, total 16ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 24ms, total 24ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 27ms, total 28ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 28ms, total 28ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 15ms, total 15ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 22ms, total 22ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 19ms, total 20ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 29ms, total 29ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 28ms, total 28ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 29ms, total 29ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 33ms, total 33ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed <1K, 25% free 10268K/13548K, paused 18ms, total 18ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 18ms, total 18ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 24ms, total 24ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 32ms, total 32ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed <1K, 25% free 10268K/13548K, paused 24ms, total 24ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 16ms, total 16ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 18ms, total 18ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 14ms, total 14ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 25ms, total 25ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 32ms, total 32ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 25ms, total 25ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 17ms, total 17ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 20ms, total 20ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 28ms, total 29ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 35ms, total 35ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 31ms, total 31ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 37ms, total 37ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 33ms, total 33ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 22ms, total 22ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 16ms, total 16ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed <1K, 25% free 10268K/13548K, paused 20ms, total 20ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 16ms, total 17ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 22ms, total 22ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 26ms, total 27ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 24ms, total 24ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 15ms, total 16ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 18ms, total 18ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 18ms, total 19ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 25ms, total 25ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 23ms, total 25ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 26ms, total 26ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 25ms, total 25ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 19ms, total 19ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1012K, 32% free 9255K/13548K, paused 24ms, total 24ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed 0K, 25% free 10268K/13548K, paused 20ms, total 20ms D/dalvikvm( 7816): GC_FOR_ALLOC freed 1013K, 32% free 9255K/13548K, paused 22ms, total 22ms I/dalvikvm-heap( 7816): Grow heap (frag case) to 11.365MB for 1036816-byte allocation D/dalvikvm( 7816): GC_FOR_ALLOC freed <1K, 25% free 10268K/13548K, paused 32ms, total 32ms

salmanDevj commented 5 years ago

i assume something is wrong here :

I/cgr.qrmv.QrReader(14379): Using old camera API. I/cgr.qrmv.QrDetector(14379): Making detector for formats: 0 W/DynamiteModule(14379): Local module descriptor class for com.google.android.gms.vision.dynamite.barcode not found. I/DynamiteModule(14379): Considering local module com.google.android.gms.vision.dynamite.barcode:0 and remote module com.google.android.gms.vision.dynamite.barcode:0 D/BarcodeNativeHandle(14379): Cannot load feature, fall back to load whole module. W/DynamiteModule(14379): Local module descriptor class for com.google.android.gms.vision.dynamite not found. I/DynamiteModule(14379): Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:1800 I/DynamiteModule(14379): Selected remote version of com.google.android.gms.vision.dynamite, version >= 1800 I/Vision (14379): Loading library libbarhopper.so I/Vision (14379): libbarhopper.so library load status: true I/cgr.qrmv.QrCameraC1(14379): Initializing with autofocus on.

rmtmckenzie commented 5 years ago

That means that the version of play services you have isn't being able to load up the qr analyzing libraries. Try updating to the most recent of play services and making sure you have a good internet connection - the first time you open the camera your phone downloads the required libraries to do the scanning (com.googl.android.gms.vision.dynamite.barcode:0). Unfortunately, there's not a whole lot I can do about it as it's a something internal to the google_mobile_vision library that's going wrong, but I realize it's not ideal at all because your end-users might experience the same thing.

Connecting while you have internet, and/or updating play services and restarting your device should hopefully resolve the issue.

Here's an issue someone else has seen: https://github.com/googlesamples/android-vision/issues/350, and there's a few more like it.

rmtmckenzie commented 5 years ago

BTW you can try adding this to your android manifest as should make the library download at install time rather than when the app first runs the qr scanner.

    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
    <meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode"/>
MahmoodBakhshayesh commented 4 years ago

try flutter clean and build project again