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

Flutter项目用flutter_telpo插件时Gradle构建失败:找不到指定依赖

Flutter Android构建失败:找不到android-zxingLibrary依赖

问题重现

FAILURE: Build failed with an exception.

  • 出错原因:任务':app:checkDebugAarMetadata'执行失败。

无法解析配置':app:debugRuntimeClasspath'的所有文件。找不到com.github.leyan95:android-zxingLibrary:0.1.2-PRE。
已在以下位置搜索:

  • https://dl.google.com/dl/android/maven2/com/github/leyan95/android-zxingLibrary/0.1.2-PRE/android-zxingLibrary-0.1.2-PRE.pom
  • https://repo.maven.apache.org/maven2/com/github/leyan95/android-zxingLibrary/0.1.2-PRE/android-zxingLibrary-0.1.2-PRE.pom
  • https://storage.googleapis.com/download.flutter.io/com/github/leyan95/android-zxingLibrary/0.1.2-PRE/android-zxingLibrary-0.1.2-PRE.pom
  • https://jcenter.bintray.com/com/github/leyan95/android-zxingLibrary/0.1.2-PRE/android-zxingLibrary-0.1.2-PRE.pom
    该依赖由project :app > project :flutter_telpo所要求。

解决方案

1. 添加JitPack仓库到项目级build.gradle

该依赖托管在JitPack仓库,默认配置未包含,需手动添加:
打开项目根目录下的android/build.gradle,修改allprojects中的repositories块:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' } // 新增这一行
    }
}

2. 验证依赖版本有效性

检查com.github.leyan95:android-zxingLibrary:0.1.2-PRE是否为有效版本:

  • 若版本不存在,可修改flutter_telpo插件的依赖版本(需调整插件本地代码或联系作者更新)
  • 替换为该仓库已发布的可用版本

3. 清理缓存并重新构建

执行以下命令清理缓存,消除旧配置干扰:

flutter clean
flutter pub get
cd android && ./gradlew clean build

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 07:07:40