Khư*_*Mai 10 java intellij-idea
输出文本:
Execution failed for task ':app:checkDebugDuplicateClasses'.
1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class org.intellij.lang.annotations.Flow found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.Identifier found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$AdjustableOrientation found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$BoxLayoutAxis found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$CalendarMonth found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$CursorType found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$FlowLayoutAlignment found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$FontStyle found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$HorizontalAlignment found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$InputEventMask found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$ListSelectionMode found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$PatternFlags found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$TabLayoutPolicy found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Duplicate class org.intellij.lang.annotations.JdkConstants$TabPlacement found in modules annotations-16.0.1.jar (org.jetbrains:annotations:16.0.1) and annotations-java5-15.0.jar (org.jetbrains:annotations-java5:15.0)
Run Code Online (Sandbox Code Playgroud)
Har*_*hra 51
这是两个罐子之间的冲突。您可以从 Modules_annotation 16.XXX 和 annotations-java5-XXXX jar 文件中找出您没有使用的那个。
我发现了两种方法来解决这个问题。
因此,更好的解决方案是在 build.gradle 文件 [s] 中查找 org.jetbrains:annotations 依赖项,如下所示:
implementation 'org.jetbrains:annotations-java5:15.0'
Run Code Online (Sandbox Code Playgroud)
...并删除它。
如果 1 不起作用
Run Code Online (Sandbox Code Playgroud)configurations { cleanedAnnotations compile.exclude group: 'org.jetbrains' , module:'annotations' }
小智 39
我通过更改解决了我的问题
implementation 'androidx.room:room-compiler:2.4.0-beta01'
Run Code Online (Sandbox Code Playgroud)
到
annotationProcessor 'androidx.room:room-compiler:2.4.0-beta01'
Run Code Online (Sandbox Code Playgroud)
Ale*_*ort 27
Harsh Mishra 的答案是正确的,但是最新版本的 Android Studio 不再声明org.jetbrains:annotations-java5:15.0
或在你的 gradle 依赖项中,并且编译org.jetbrains.kotlin:kotlin-stdlib:$version_kotlin
的使用也被实现所取代,这样你的 build.gradle 应该如下所示:
plugins {
...
}
android {
...
}
configurations {
cleanedAnnotations
implementation.exclude group: 'org.jetbrains' , module:'annotations'
}
dependencies {
...
}
Run Code Online (Sandbox Code Playgroud)
这是两个不同 lib/jar 文件中的单个工件之间的冲突。基本上,我们需要删除未使用的库或从任何一个库中删除工件。
从Kotlin 1.4开始,您不再需要以下依赖项
implementation "org.jetbrains.kotlin:kotlin-stdlib:$version_kotlin"
Run Code Online (Sandbox Code Playgroud)
所以删除这个依赖也可以解决这个问题。
归档时间: |
|
查看次数: |
9837 次 |
最近记录: |