android studio升級(jí)到 Arctic Fox (2020.3.1),相應(yīng)gradle插件升級(jí)到7.0.0之后,出現(xiàn)重復(fù)類,因?yàn)椴煌姹镜膉ar包,如下:
Duplicate class org.intellij.lang.annotations.Subst found in modules jetified-annotations-12.0 (com.intellij:annotations:12.0) and jetified-annotations-13.0 (org.jetbrains:annotations:13.0)
原因:
使用了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'
}
}