我想在我的项目中导入线圈库。我这样做如下:
android{
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation("io.coil-kt:coil:0.8.0")
}
该项目将成功同步,但是当我想运行该应用程序时,我将遇到此错误:
Duplicate class androidx.appcompat.content.res.AppCompatResources found in modules classes.jar (androidx.appcompat:appcompat-resources:1.1.0) and classes.jar (androidx.appcompat:appcompat:1.0.0)
Duplicate class androidx.appcompat.content.res.AppCompatResources$ColorStateListCacheEntry found in modules classes.jar (androidx.appcompat:appcompat-resources:1.1.0) and classes.jar (androidx.appcompat:appcompat:1.0.0)
Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat found in modules classes.jar (androidx.appcompat:appcompat-resources:1.1.0) and classes.jar (androidx.appcompat:appcompat:1.0.0)
Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$1 found in modules classes.jar (androidx.appcompat:appcompat-resources:1.1.0) and classes.jar (androidx.appcompat:appcompat:1.0.0)
我的应用程序之前已转换为 AndroidX。另外,我targetSdkVersion = 29
和minSdkVersion = 17