android – 找不到Google Vision条形码库

前端之家收集整理的这篇文章主要介绍了android – 找不到Google Vision条形码库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图使用Google Play Services(Vision)中的新功能,为我的应用程序添加QR码扫描.但是当我运行我的应用程序时,我得到:
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.

我已经根据教程声明了条形码依赖:

<Meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode" />

我尝试重新安装应用程序并重新启动手机,没有任何帮助.

使用Google Play Services 7.8,设备上安装的版本为7.8.11.

compile 'com.google.android.gms:play-services-vision:7.8.0'

用于创建条形码检测器的代码

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;
}

上面的close返回false并完成活动,因为barcodeDetector.isOperational()返回false.

解决方法

Google已经确认了一个错误,他们将尽快修复,这在某些情况下阻止您使用此条形码/面部检测库(链接 here):
  • A service required by Mobile Vision is now disabled due to a serIoUs bug in that service. This will prevent users who have not
    already used face or barcode detection from using those features. We
    do not recommend adding new Mobile Vision features to your app until
    this issue is fixed.
  • For apps that already use Mobile Vision features,check FaceDetector.isOperational() or BarcodeDetector.isOperational() to
    confirm detector readiness before using the face or barcode detector.

它也写在Google的github示例回购报告的一些问题上:

https://github.com/googlesamples/android-vision/issues

示例(here):

There is a known issue with the new version of GMscore (v9) that was just released today.

猜你在找的Android相关文章