【问题标题】:Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform artifact 'annotation-experimental.aar无法解决 \':app@debug/compileClasspath\' 的依赖关系:无法转换工件 \'annotation-experimental.aar
【发布时间】:2022-09-23 15:12:25
【问题描述】:

我是 Kotlin 的新手,我刚刚在 Android Studio 中使用 Kotlin 创建了我的第一个应用程序。但是,我在下面收到此错误消息。我无法启动,因为我的应用程序无法构建。我已经尝试过Invalidate Caches/Restart但没有任何反应。

JDK版本:11.0.16.1, Android Studio 版本:3.4.1

ERROR: Unable to resolve dependency for \':app@debug/compileClasspath\': Failed to 
transform artifact \'annotation-experimental.aar (androidx.annotation:annotation- 
experimental:1.3.0)\' to match attributes {artifactType=jar}
Affected Modules: app


ERROR: Unable to resolve dependency for \':app@debugAndroidTest/compileClasspath\':         
Failed to transform artifact \'annotation-experimental.aar    
(androidx.annotation:annotation-experimental:1.3.0)\' to match attributes 
{artifactType=jar}
Affected Modules: app


ERROR: Unable to resolve dependency for \':app@debugUnitTest/compileClasspath\': Failed     
to transform artifact \'annotation-experimental.aar (androidx.annotation:annotation- 
experimental:1.3.0)\' to match attributes {artifactType=jar}
Affected Modules: app


ERROR: Unable to resolve dependency for \':app@release/compileClasspath\': Failed to     
transform artifact \'annotation-experimental.aar (androidx.annotation:annotation- 
experimental:1.3.0)\' to match attributes {artifactType=jar}
Affected Modules: app


ERROR: Unable to resolve dependency for \':app@releaseUnitTest/compileClasspath\': 
Failed to transform artifact \'annotation-experimental.aar 
(androidx.annotation:annotation-experimental:1.3.0)\' to match attributes 
{artifactType=jar}
Affected Modules: app

我的依赖:

dependencies {
   implementation fileTree(dir: \'libs\', include: [\'*.jar\'])
   implementation\"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version\"
   implementation \'androidx.appcompat:appcompat:1.5.1\'
   implementation \'androidx.core:core-ktx:1.9.0\'
   implementation \'androidx.constraintlayout:constraintlayout:2.1.4\'
   testImplementation \'junit:junit:4.12\'
   androidTestImplementation \'androidx.test:runner:1.4.0\'
   androidTestImplementation \'androidx.test.espresso:espresso-core:3.4.0\'
}

    标签: android android-studio kotlin


    【解决方案1】:
     implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version
    

    你有提到 $kotlin_version 的版本吗?

    【讨论】:

      【解决方案2】:

      只想分享我是如何解决这个错误的。我将 core-ktx 的版本从androidx.core:core-ktx:1.9.0降低到androidx.core:core-ktx:1.8.0

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-12-15
        • 1970-01-01
        • 1970-01-01
        • 2018-08-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多