android studio升級(jí)到 Arctic Fox (2020.3.1),相應(yīng)gradle插件升級(jí)到7.0.0之后,出現(xiàn)重復(fù)類(lèi),因?yàn)椴煌姹镜膉ar包,如下:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class org.intellij.lang.annotations.Identifier found in modules jetified-annotations-12.0 (com.intellij:annotations:12.0) and jetified-annotations-21.0.1 (org.jetbrains:annotations:21.0.1)
原因:
使用了jetbrains的一些注解,但是使用的不同jar中的
解決方案:
在app的build.gradle中增加如下的exclude(只能exclude一個(gè),不能兩個(gè)都exclude):
android {
configurations {
cleanedAnnotations
// implementation.exclude group: 'org.jetbrains' , module:'annotations'
implementation.exclude group: 'com.intellij' , module:'annotations'
}
}