Gradle - 在模块 kotlin-compiler-1.9.22 中找到重复的类 com.google.common.util.concurrent.ListenableFuture

问题描述 投票:0回答:1

在包含 kotlin 编译器的自定义 sdk 项目的依赖项中添加实现后出现此问题。 我已经将双方的库升级到最新版本(应用程序和 SDK)

重复类 com.google.common.util.concurrent.ListenableFuture 在模块 kotlin-compiler-1.9.22 中找到 (org.jetbrains.kotlin:kotlin-compiler:1.9.22) 和 Listenablefuture-1.0 (com.google.guava:listenablefuture:1.0) 重复类 在模块注释23.0中找到org.jetbrains.annotations.Nls (org.jetbrains:annotations:23.0.0) 和 kotlin-compiler-1.9.22 (org.jetbrains.kotlin:kotlin-compiler:1.9.22) 重复类 org.jetbrains.annotations.Nls$在模块中发现大写 注释-23.0 (org.jetbrains:annotations:23.0.0) 和 kotlin-compiler-1.9.22 (org.jetbrains.kotlin:kotlin-compiler:1.9.22)

dependencies {
    implementation "conflicting_custom_sdk_that_contains_kotlin_compiler_etc:0.0.1"

    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
    implementation 'androidx.activity:activity-compose:1.8.2'
    implementation platform('androidx.compose:compose-bom:2023.10.01')
    implementation 'androidx.compose.ui:ui'
    implementation 'androidx.compose.ui:ui-graphics'
    implementation 'androidx.compose.ui:ui-tooling-preview'
    implementation 'androidx.compose.material3:material3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation platform('androidx.compose:compose-bom:2023.10.01')
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
    debugImplementation 'androidx.compose.ui:ui-tooling'
    debugImplementation 'androidx.compose.ui:ui-test-manifest'
}
java android kotlin gradle duplicates
1个回答
0
投票

解决此问题的最简单方法,而不是在您的 sdk 中使用

implementation
。您可以使用
compileOnly
,它应该看起来像这样。

compileOnly "conflicting_custom_sdk_that_contains_kotlin_compiler_etc:0.0.1"
© www.soinside.com 2019 - 2024. All rights reserved.