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

升级Firebase BoM至34.2.0后,Gradle无法解析Firebase相关KTX库及Glide依赖库的问题

升级Firebase BoM至34.2.0后,Gradle无法解析Firebase相关KTX库及Glide依赖库的问题

嘿,我帮你捋捋当前碰到的两个核心问题,咱们一步步解决:

一、Firebase KTX依赖找不到的问题

从错误日志能看出来,Gradle拿不到firebase-storage-ktx、firebase-crashlytics-ktx、firebase-analytics-ktx的版本号,虽然你已经加了Firebase BoM,但可能是这几个小细节没注意:

  • 依赖写法的小问题:检查下你这三个依赖的引号,别用转义的",换成正常的双引号就行,正确写法是:
    implementation("com.google.firebase:firebase-storage-ktx")
    implementation("com.google.firebase:firebase-crashlytics-ktx")
    implementation("com.google.firebase:firebase-analytics-ktx")
    
  • BoM的版本覆盖问题:你给firebase-auth-ktx单独指定了23.2.1的版本,这会打乱BoM的统一版本管理,容易出冲突。建议把这个版本号删掉,让BoM帮你管:
    implementation("com.google.firebase:firebase-auth-ktx")
    
  • 仓库配置要到位:别忘了在项目根目录的build.gradle(或者新版的settings.gradle)里加上Google Maven仓库,不然Gradle找不到Firebase的依赖:
    repositories {
        google()
        mavenCentral()
    }
    

二、Glide 5.0.0依赖拉取不到的问题

错误里说找不到gifdecoder:5.0.0和disklrucache:5.0.0,这其实是因为Glide 5.x还在预览开发阶段,没正式发布到Maven Central或者Google Maven仓库,有两个解决办法:

方案1:切回Glide稳定版(强烈推荐)

把Glide版本换回最新的稳定版,比如4.16.0,同时编译器版本也要对应上,别搞版本不一致:

// Glide相关依赖
implementation 'com.github.bumptech.glide:glide:4.16.0'
ksp 'com.github.bumptech.glide:compiler:4.16.0'

方案2:加Glide预览仓库(不建议用于生产环境)

如果你非要用5.0.0版本,得在根目录的settings.gradle或者build.gradle里加上Glide的快照仓库:

repositories {
    // 保留你原来的仓库...
    maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
}

而且Glide和编译器的版本都要换成5.x的快照版:

implementation 'com.github.bumptech.glide:glide:5.0.0-SNAPSHOT'
ksp 'com.github.bumptech.glide:compiler:5.0.0-SNAPSHOT'

最后一步:刷新依赖

改完之后,执行下面的Gradle命令清理缓存并刷新依赖,应该就能解决问题了:

./gradlew clean build --refresh-dependencies

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.07 09:02:58