Gradle无法解析androidx.compose:compose-bom:2026.06.00
问题
我想把我的Jetpack Compose版本升级到最新的可用版本。
根据Compose BOM映射页面:
https://developer.android.com/develop/ui/compose/bom/bom-mapping
最新的Compose BOM版本似乎是 2026.06.00。
然而,当我尝试在我的项目中使用它时,Gradle同步失败,错误如下所示:
Failed to resolve: androidx.compose:compose-bom:2026.06.00
而无论如何尝试构建项目,结果如下错误:
Configuration cache state could not be cached: field `__runtimeDependenciesNavigationFiles__` of task `:app:processDebugNavigationResources` of type `com.android.build.gradle.internal.tasks.ProcessNavigationXmlTask`: error writing value of type 'org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection'
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find androidx.compose:compose-bom:2026.06.00.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/compose/compose-bom/2026.06.00/compose-bom-2026.06.00.pom
- https://repo.maven.apache.org/maven2/androidx/compose/compose-bom/2026.06.00/compose-bom-2026.06.00.pom
Required by:
project ':app'
这个版本还没有被包含在Maven仓库中吗? 我是不是在做错了什么?
项目
版本目录:
agp = "9.1.1"
kotlin = "2.3.0"
ksp = "2.3.4"
composeBom = "2026.06.00" // with 2026.05.01 works fine
gradle-wrapper:
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
解决方案
截至我写这份时,那个BOM尚未在Google Maven仓库中发布,它应该就在那里。也有可能文档有误。
更新2026-06-17:2026.06.00 BOM已经发布(https://maven.google.com/web/index.html#androidx.compose:compose-bom:2026.06.00)。
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。