未找到Google Vision条形码库

mic*_*k88 15 android barcode google-play-services google-vision android-vision

我正在尝试使用Google Play服务(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.
Run Code Online (Sandbox Code Playgroud)

我按照教程声明了条形码依赖:

<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode" />
Run Code Online (Sandbox Code Playgroud)

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

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

compile 'com.google.android.gms:play-services-vision:7.8.0'
Run Code Online (Sandbox Code Playgroud)

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

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;
}
Run Code Online (Sandbox Code Playgroud)

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

and*_*per 9

Google已确认他们即将修复的错误,这可能会阻止您在某些情况下使用此条形码/面部检测库(此处链接):

  • 由于该服务存在严重错误,因此Mobile Vision所需的服务现已停用.这将阻止尚未使用面部或条形码检测的用户使用这些功能.在修复此问题之前,我们不建议您向应用添加新的Mobile Vision功能.
  • 对于已经使用Mobile Vision功能的应用,请在使用面部或条形码检测器之前检查FaceDetector.isOperational()或BarcodeDetector.isOperational()以确认检测器就绪状态.

它也写在谷歌的github样本回购中报告的一些问题上:

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

示例(此处):

今天刚刚发布的新版GMSCore(v9)存在一个已知问题.


mic*_*k88 6

它在清除缓存并释放一些空间后开始工作.我有"仅"400mb的可用空间,并且没有任何错误消息表明这一点.


Jar*_*ows 5

基于此处的文档: https : //developers.google.com/android/reference/com/google/android/gms/vision/package-summary和此处: https : //developers.google.com/android/reference/ com/google/android/gms/vision/Detector#isOperational()

文档:

公共布尔 isOperational()

指示检测器是否具有本地可用的所有必需依赖项以进行检测。

首次安装应用程序时,可能需要下载所需文件。如果返回 false,则这些文件尚不可用。通常在应用程序安装时会处理此下载,但这不能保证。在某些情况下,下载可能会延迟。

如果您的代码添加了处理器,则检测器操作状态的指示也会通过检测器IsOperational() 方法来指示。你可以在你的应用程序中检查它,因为它处理检测结果,如果合适,可以将此状态传达给用户。

如果检测器正在运行,则返回 •true,如果正在下载依赖项,则返回 false

公共布尔检测器IsOperational()

如果检测器可运行,则返回 true,如果检测器不可运行,则返回 false。在非操作情况下,检测器不会返回任何结果。

如果需要下载以获取执行检测所需的关联库和模型文件,则在第一次启动应用程序时,检测器可能会暂时无法运行。

看起来您的设备需要通过 Google Play 服务完成库的下载才能让您的应用程序立即运行。

基于谷歌样本(来源中的评论):

        // Note: The first time that an app using the barcode or face API is installed on a
        // device, GMS will download a native libraries to the device in order to do detection.
        // Usually this completes before the app is run for the first time.  But if that
        // download has not yet completed, then the above call will not detect any barcodes
        // and/or faces.
        //
        // isOperational() can be used to check if the required native libraries are currently
        // available.  The detectors will automatically become operational once the library
        // downloads complete on device.
Run Code Online (Sandbox Code Playgroud)

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

  • 是的,这并不能真正回答问题。我们已经知道了。问题是,很多用户都在使用 Wi-Fi,有大量空闲空间,而图书馆仍然拒绝下载。然后对于一些用户来说,他们在几天后就开始工作了。一个更完整的解释,最好来自谷歌,会很好。 (8认同)