I'm trying to use the new feature in Google Play Services (Vision) to add QR code scanning to my application. But when I run my app I get this:
I/Vision﹕ Supported ABIS: [armeabi-v7a, armeabi]
D/Vision﹕ Library not found: /data/data/com.google.android.gms/files/com.google.android.gms.vision/barcode/libs/armeabi-v7a/libbarhopper.so
I/Vision﹕ Requesting barcode detector download.
I have declared barcode dependency as per tutorial:
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode" />
I tried reinstalling the app and restarting the phone, nothing helps.
Using Google Play Services 7.8, version installed on the device is 7.8.11.
compile 'com.google.android.gms:play-services-vision:7.8.0'
Code used for creating the barcode detector:
boolean initBarcodeDetector() {
final BarcodeTrackerFactory barcodeTrackerFactory = new BarcodeTrackerFactory(this);
final MultiProcessor<Barcode> multiProcessor = new MultiProcessor.Builder<>(barcodeTrackerFactory)
.build();
barcodeDetector = new BarcodeDetector.Builder(this)
.build();
barcodeDetector.setProcessor(multiProcessor);
if (barcodeDetector.isOperational() == false) {
Toast.makeText(this, R.string.barcode_not_operational, Toast.LENGTH_LONG).show();
finish();
return false;
}
return true;
}
the above close returns false and finishes activity because barcodeDetector.isOperational()
returns false
.
Google has confirmed a bug that they will fix soon, which prevents you in some cases to use this library of barcode/face-detection (link here) :
It's also written in some issues reported on Google's github sample repo:
https://github.com/googlesamples/android-vision/issues
Example (here) :
Based on the documentation here: https://developers.google.com/android/reference/com/google/android/gms/vision/package-summary and here: https://developers.google.com/android/reference/com/google/android/gms/vision/Detector#isOperational()
Documentation:
and
It looks like your device needs to finish downloading the libraries through Google Play Services in order for your application to work right away.
Based on the Google Samples(a comment in the source):
https://github.com/googlesamples/android-vision/blob/master/visionSamples/multi-tracker/app/src/main/java/com/google/android/gms/samples/vision/face/multitracker/MultiTrackerActivity.java#L156
Mobile Vision operation is restored in Google Play Services v9.2 https://developers.google.com/vision/release-notes#google_play_services_92
It started working after I cleared cache and freed up some space. I had "only" 400mb free space and there was no error message which would indicate that.
I also had same experience. (sorry I can't comment to add my case because I only have 1 rep) I am using Nexus 5 (2013) with marshmallow (6.0). I started with 1gb free space and didn't work and didn't work at 2gb. I ended up freeing another 1gb (so 3gb free space) then it worked.
I also experienced this, the vision library could not be found on one of my test devices, although the console showed a request of the library on every start of the app, but never finished. I tested on Nexus 4,5 Motorola X2, Samsung S 2-6 and various other devices, the S5 was the only devices with the Problem. There was enough free space with over 2Gb, after hard resetting the device the scanning worked instantly as intended.