无法运行和预览 Android Jetpack Compose jcenter 不起作用

时间:2021-03-24 09:24:36

标签: android android-jetpack android-jetpack-compose

我想学习android compose。但是,当我想运行我的项目时遇到了这个错误。

请帮帮我。我想不通。

论坛中的许多其他人建议我使用 jcenter() 但是,对我来说仍然不起作用。我做错了吗? gradle with jcenter()

这是我的 gradle 配置。 Gradle Configuration

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.3.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlinx/kotlinx-collections-immutable-jvm/0.3.3/kotlinx-collections-immutable-jvm-0.3.3.pom
       - https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-collections-immutable-jvm/0.3.3/kotlinx-collections-immutable-jvm-0.3.3.pom
     Required by:
         project :app > androidx.compose.ui:ui:1.0.0-beta01 > androidx.compose.runtime:runtime:1.0.0-beta01

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

enter image description here

1 个答案:

答案 0 :(得分:0)

org.jetbrains.kotlinx:kotlinx-collections-immutable 在 jcenter 上仍然可用。这里有一个与此相关的问题:https://github.com/Kotlin/kotlinx.collections.immutable/issues/96

jcenter() 添加到您的 repositories 块:

repositories {
    ...
    jcenter()
}