【问题标题】:Error finding jetpack compose compiler Could not find androidx.compose:compose-compiler:1.0.0-alpha11查找jetpack compose编译器时出错找不到androidx.compose:compose-compiler:1.0.0-alpha11
【发布时间】:2021-02-14 22:15:44
【问题描述】:

我在一个 android 项目中遇到此错误。

Could not find androidx.compose:compose-compiler:1.0.0-alpha11.
 Searched in the following locations:
   - https://maven.google.com/androidx/compose/compose-compiler/1.0.0-alpha11/compose-compiler-1.0.0-alpha11.pom
   - https://jcenter.bintray.com/androidx/compose/compose-compiler/1.0.0-alpha11/compose-compiler-1.0.0-alpha11.pom
   - https://repo.maven.apache.org/maven2/androidx/compose/compose-compiler/1.0.0-alpha11/compose-compiler-1.0.0-alpha11.pom

如您所见,我已根据教程添加了 google 存储库。

构建 Gradle 的配置如下:

build.gradle.kts

dependencies {
val composeVersion = "1.0.0-alpha11"
//val composeVersion = "0.1.0-dev10"
implementation(project(":shared"))
//implementation ("androidx.compose.runtime:runtime:$composeVersion")
//implementation ("androidx.compose.compiler:compiler:$composeVersion")
implementation("com.google.android.material:material:1.2.1")
implementation("androidx.appcompat:appcompat:1.2.0")
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2")


implementation ("androidx.compose.ui:ui:$composeVersion")
// Tooling support (Previews, etc.)
//implementation ("androidx.compose.ui:ui-tooling:$composeVersion")
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation ("androidx.compose.foundation:foundation:$composeVersion")
// Material Design
implementation ("androidx.compose.material:material:$composeVersion")
// Material design icons
implementation ("androidx.compose.material:material-icons-core:$composeVersion")
implementation ("androidx.compose.material:material-icons-extended:$composeVersion")
// Integration with observables
implementation ("androidx.compose.runtime:runtime-livedata:$composeVersion")
implementation ("androidx.compose.runtime:runtime-rxjava2:$composeVersion")

 //UI Tests
//androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.0.0-alpha10'
}

android {
   compileSdkVersion(29)
   defaultConfig {
    applicationId = "com.myTempOrg.myTestApp.androidApp"
    minSdkVersion(24)
    targetSdkVersion(29)
    versionCode = 1
    versionName = "1.0"
}
buildFeatures {
    compose = true
}

composeOptions {
    kotlinCompilerVersion = "1.4.21"
    kotlinCompilerExtensionVersion = "1.0.0-alpha11"
}

kotlinOptions {
    jvmTarget = "1.8"
    useIR = true
}

我也尝试过降级到似乎找到的 alpha03,但在那里遇到了其他缺少依赖项的问题。

【问题讨论】:

  • 发布您的项目build.gradle

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


【解决方案1】:

kotlinCompilerVersion 应该是 alpha 11 的“1.4.21-2”。

请注意,alpha 12 现已发布,您可以使用以下依赖项进行升级:link to alpha 12 dependencies

你还需要添加这个:link to further instructions for updating to alpha 12

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-30
    • 2016-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多