【问题标题】:Can not use Google Barcode scanner无法使用谷歌条形码扫描仪
【发布时间】:2016-05-22 07:51:42
【问题描述】:

我从https://github.com/googlesamples/android-vision尝试了谷歌条形码阅读器

这个例子不起作用。当我点击屏幕时,它总是会检测到

“未检测到条形码”

调试原因:

private boolean onTap(float rawX, float rawY) {

    //TODO: use the tap position to select the barcode.
    BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
    Barcode barcode = null;
    if (graphic != null) {
        barcode = graphic.getBarcode();
        if (barcode != null) {
            Intent data = new Intent();
            data.putExtra(BarcodeObject, barcode);
            setResult(CommonStatusCodes.SUCCESS, data);
            finish();
        }
        else {
            Log.d(TAG, "barcode data is null");
        }
    }
    else {
        Log.d(TAG,"no barcode detected");
    }
    return barcode != null;
}

graphic 变量总是Null

看图:

有人遇到过这个问题吗?你能告诉我如何解决吗? 非常感谢!

【问题讨论】:

  • 你在什么硬件上测试这个?

标签: android android-vision


【解决方案1】:

所以我来宾您是 Android Mobile Vision 的新手,在新版本的 Google Play 服务 (v9) 中,由于该功能存在严重错误,他们暂时禁用了该功能,您可以在此处查看发行说明:

https://developers.google.com/android/guides/releases#may_2016_-_v90

【讨论】:

    【解决方案2】:

    正如@Vietnt134 已经回答的那样,Android Mobile Vision 暂时被禁用。

    您可以关注此主题以了解是否出现了已知情况: https://github.com/googlesamples/android-vision/issues/98

    人们对谷歌非常生气。我希望他们能尽快解决这个问题。

    【讨论】:

      【解决方案3】:

      getFirstGraphic 在没有图形添加到叠加层时返回 null;在条形码示例中,这是在框架中未检测到条形码的情况。

      检查barcodeDetector.isOperational() 是否在 BarcodeCaptureActivity.java 中返回 false。如果它返回 false,持续了几分钟,并且您没有处于低存储状态,则很有可能这是由于当前的服务中断造成的。

      更多细节可以在这里找到:https://github.com/googlesamples/android-vision/issues/98我们会在找到解决方案后立即更新该问题。

      【讨论】:

        猜你喜欢
        • 2023-04-07
        • 1970-01-01
        • 1970-01-01
        • 2012-08-08
        • 2020-11-18
        • 1970-01-01
        • 1970-01-01
        • 2018-07-05
        • 1970-01-01
        相关资源
        最近更新 更多