I am new to Kotlin and I just created my first application using Kotlin in Android Studio. However, I am getting this error message below. I couldn’t start because my app won’t build. I already tried Invalidate Caches/Restart
but nothing happens.
JDK version: 11.0.16.1,
Android Studio version: 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
My dependencies:
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'
}
2
Answers
Just wanna share how I resolved this error. I lowered the version of core-ktx from
androidx.core:core-ktx:1.9.0
toandroidx.core:core-ktx:1.8.0
.have you mentioned the version for
$kotlin_version
?