首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >谷歌视觉条形码库未找到

谷歌视觉条形码库未找到
EN

Stack Overflow用户
提问于 2015-08-19 15:16:18
回答 7查看 18.6K关注 0票数 15

我正在尝试使用Google Play Services (Vision)中的新功能将QR代码扫描添加到我的应用程序中。但是当我运行我的应用程序时,我得到了这样的信息:

代码语言:javascript
代码运行次数:0
运行
复制
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.

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

代码语言:javascript
代码运行次数:0
运行
复制
<meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode" />

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

使用Google 7.8,设备上安装的版本为7.8.11。

代码语言:javascript
代码运行次数:0
运行
复制
compile 'com.google.android.gms:play-services-vision:7.8.0'

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

代码语言:javascript
代码运行次数: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;
}

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

EN

回答 7

Stack Overflow用户

回答已采纳

发布于 2015-08-20 16:49:30

在我清除缓存并释放一些空间之后,它就开始工作了。我有“仅”400 no的空闲空间,并且没有错误消息表明这一点。

票数 6
EN

Stack Overflow用户

发布于 2016-05-22 13:13:27

谷歌已经确认了一个很快就会修复的漏洞,这在某些情况下会阻止你使用这个条形码/人脸检测库(链接here):

  • Mobile所需的服务现在由于该服务中的严重错误而被禁用。这将防止尚未使用face或条形码检测的用户使用这些功能。我们不建议添加新的移动视觉功能到您的应用程序,直到这个问题是固定的。
  • 对于已经使用移动视觉功能的应用程序,在使用面部或条形码检测器之前,请检查FaceDetector.isOperational()或BarcodeDetector.isOperational()以确认检测器是否就绪。

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

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

示例(here):

今天刚刚发布的GMSCore (v9)新版本有一个已知的问题。

票数 9
EN

Stack Overflow用户

发布于 2015-08-19 16:26:39

基于以下文档的 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,则这些文件还不可用。通常这种下载是在应用程序安装时处理的,但这并不是保证的。在某些情况下,下载可能被延迟了。 如果您的代码添加了一个处理器,则还可以使用detectorIsOperational()方法指示检测器的操作状态。您可以在应用程序处理检测结果时检查此状态,并在适当情况下将此状态传递给用户。 如果检测器是可操作的,则返回·true,如果依赖项下载正在进行,则返回false

公共布尔值detectorIsOperational() 如果检测器是可操作的,则返回true,如果它不能工作,则返回false。在非操作情况下,检测器将不会返回任何结果。 当第一次启动应用程序时,如果需要下载以获得执行检测所需的相关库和模型文件,则检测器可在一段时间内不工作。

看起来你的设备需要完成通过Google服务下载库,这样你的应用程序才能马上工作。

基于Google示例(源中的评论):

代码语言:javascript
代码运行次数:0
运行
复制
        // 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.

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

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32099530

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档