gpt4 book ai didi

android - Gradle 找不到 Android Compose 编译器

转载 作者:行者123 更新时间:2023-12-03 13:24:57 25 4
gpt4 key购买 nike

我对这个问题感到非常困惑。我的 gradle 文件中有以下几行:

implementation "androidx.compose.runtime:runtime:1.0.0-alpha04"
implementation "androidx.compose.compiler:compiler:1.0.0-alpha04"
implementation "androidx.compose.runtime:runtime-rxjava2:1.0.0-alpha04"
但是,当我构建时,我收到以下错误:
Could not determine the dependencies of task ':app-name-omitted:prepareDebugKotlinCompileTask'.
> Could not resolve all task dependencies for configuration ':app-name-omitted:kotlin-extension'.
> Could not find androidx.compose:compose-compiler:1.0.0-alpha04.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/androidx/compose/compose-compiler/1.0.0-alpha04/compose-compiler-1.0.0-alpha04.pom
- https://repo.maven.apache.org/maven2/androidx/compose/compose-compiler/1.0.0-alpha04/compose-compiler-1.0.0-alpha04.pom
- https://jcenter.bintray.com/androidx/compose/compose-compiler/1.0.0-alpha04/compose-compiler-1.0.0-alpha04.pom
Required by:
project :app-name-omitted

Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
我对此感到困惑,因为编译器确实存在于 Google 的存储库中: https://maven.google.com/web/index.html#androidx.compose.compiler:compiler
如有必要,我可以发布更多信息,但我想保持简单。即使compose设置完全错误,为什么它找不到POM文件?

最佳答案

更新 gradle 版本后遇到同样的问题并解决

classpath "com.android.tools.build:gradle:4.2.0-alpha14"
而不是声明编译器版本 kotlinCompilerExtensionVersion在 composeoptions 中,标记为依赖项
implementation "androidx.ui:ui-tooling:$compose_version"
implementation "androidx.compose.runtime:runtime:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_version"

关于android - Gradle 找不到 Android Compose 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64377577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com