You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google ML Kit安卓条码扫描示例APP无法识别条码求助

Google ML Kit 实时条码检测失败:模型下载等待异常与类找不到错误

我正在尝试用Google ML Kit实现实时相机预览的条码识别功能,已经用上了谷歌官方的ML Kit示例APP,也关联好了Firebase项目。但进入条码检测对应的LivePreviewActivity后,相机能正常启动,却完全识别不了任何条码。

我已经按照官方指南做了这些配置:

  • 在Manifest文件中添加了模型依赖的meta-data声明,确保自动下载条码检测模型:
<meta-data android:name="com.google.firebase.ml.vision.DEPENDENCIES" android:value="barcode" />
  • 在BarcodeScanningProcessor.java里指定了要检测的条码格式为CODE_128:
FirebaseVisionBarcodeDetectorOptions options = new FirebaseVisionBarcodeDetectorOptions.Builder()
    .setBarcodeFormats(FirebaseVisionBarcode.FORMAT_CODE_128)
    .build();

但Logcat里一直抛出这些错误:

Barcode detection failed com.google.firebase.ml.common.FirebaseMLException: Waiting for the barcode detection model to be downloaded. Please wait.
E/BarcodeNativeHandle: Error Loading module
java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.chimera.DynamiteModuleInitializer"

这个问题在华为Mate 8和三星Galaxy S7 Edge两台设备上都出现了,我试了等很久模型也没下载完成,条码识别完全没法工作。有没有大佬能帮忙分析下问题出在哪,怎么解决?

内容的提问来源于stack exchange,提问作者CuriousHash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:47:41