Dem*_*god 19 android gradle kotlin gradle-kotlin-dsl kotlin-dsl
我开始从build.gradle(Groovy)迁移到build.gradle.kts(Kotlin DSL)。问题是com.google.common.util.concurrent.ListenableFuture(from com.google.guava) 存在于几个依赖项中。由于该构建失败并java.lang.RuntimeException: Duplicate class ...出现错误。
以前(当我build.gradle在 Groovy 中时)这个问题是用这个片段解决的:
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
Run Code Online (Sandbox Code Playgroud)
但是我使用 Kotlin DSL 找不到任何类似的东西。您能否为上面的代码片段提供 Kotlin 替代方案,或者建议任何其他解决方案来解决这个问题?
cst*_*roe 33
这适用于 Gradle Kotlin DSL:
configurations {
all {
exclude(group = "com.google.guava", module = "listenablefuture")
}
}
Run Code Online (Sandbox Code Playgroud)
Yon*_*bbs 11
这可能有效(虽然我还没有尝试过):
configurations.forEach { it.exclude("com.google.guava", "listenablefuture") }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6677 次 |
| 最近记录: |