提问人:pierre.b 提问时间:10/30/2023 更新时间:11/16/2023 访问量:90
Android gradle:无法解析:androidx.compose.material3:material3 使用 lib.versions.toml 中的 BOM
Android gradle: Failed to resolve: androidx.compose.material3:material3 using BOM from lib.versions.toml
问:
我有一个 android(compose)项目,带有一个 libs.versions.toml 用于版本目录。
在这个 .toml 中,我声明了一个 compose BOM 和一些库,如下所示:
[versions]
ksp = "1.9.10-1.0.13"
...
androidxComposeBom = "2023.10.01"
[libraries]
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
...
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3"}
androidx-compose-material3-windowSizeClass = { group = "androidx.compose.material3", name = "material3-window-size-class" }
执行此操作时,我收到“无法解析:androidx.compose.material3:material3”和“无法解析:androidx.compose.material3:material3-window-size-class”的错误。
我只在 material3 库上收到错误,而不是“ui”或其他在 BOM 中具有其版本的错误
如果我指定如下版本,它可以工作:
[versions]
material3VersionHack = "1.1.2"
[libraries]
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3VersionHack"}
但是这违背了 BOM 的目的:避免指定每个版本......
根据 https://developer.android.com/jetpack/compose/bom/bom-mapping material3 是用 BOM 2023.10.01 的 1.1.2 版本定义的,那又怎样?
=> 为什么我需要手动指定 material3 的版本?有没有办法依赖当前 BOM 定义的版本?
答: 暂无答案
评论