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

Flutter应用二维码扫描后无法打开结果页及TF Lite版本兼容报错

问题解决:Flutter二维码扫描器TF Lite版本不兼容报错

报错详情

W/native (29858): W0000 00:00:1693997505.755634 31475 abi_method_util.h:33] not supported: TfLiteInterpreterGetTensor: TF Lite in Google Play services has stable ABI version 1.11.0 which is less than the required version 1.13.0.

该报错是因为设备上Google Play服务内置的TensorFlow Lite版本(1.11.0)低于二维码扫描依赖库要求的1.13.0版本,导致相机初始化异常,扫描完成后无法正常跳转结果页。

解决方法

1. 更新Google Play服务

  • 打开设备的Google Play商店,搜索「Google Play服务」,检查是否有可用更新,直接更新到最新版本。
  • 部分设备可能需要重启后才能生效。

2. 替换扫描库的TF Lite依赖方式

如果无法更新Google Play服务,可修改二维码扫描库的配置,强制使用本地内置的TF Lite版本而非依赖Google Play服务的版本:

  • 若使用的是qr_code_scanner库,在安卓项目的build.gradle(模块级)中添加以下配置:
android {
    dependencies {
        // 排除Google Play服务的TF Lite依赖,使用本地版本
        implementation('io.flutter.plugins:qr_code_scanner') {
            exclude group: 'com.google.android.gms', module: 'play-services-tflite'
        }
        // 添加本地TF Lite依赖
        implementation 'org.tensorflow:tensorflow-lite:2.15.0'
    }
}
  • 执行flutter clean和flutter pub get,重新编译项目。

3. 降级扫描库版本

如果上述方法无效,可尝试降级二维码扫描库到对TF Lite版本要求更低的旧版本:

  • 修改pubspec.yaml中扫描库的版本,比如将qr_code_scanner: ^1.0.1改为更低的兼容版本(如^0.7.0),具体版本可查看库的历史版本说明。
  • 执行flutter pub get后重新运行项目。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.11 12:52:04