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性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...