问题描述:
在集成百度地图时jar包、so库已同步到本地 在编译项目的时候报以下错误:
1 Duplicate class org.intellij.lang.annotations.Flow found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 2 Duplicate class org.intellij.lang.annotations.Identifier found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 3 Duplicate class org.intellij.lang.annotations.JdkConstants found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 4 Duplicate class org.intellij.lang.annotations.JdkConstants$AdjustableOrientation found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 5 Duplicate class org.intellij.lang.annotations.JdkConstants$BoxLayoutAxis found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 6 Duplicate class org.intellij.lang.annotations.JdkConstants$CalendarMonth found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 7 Duplicate class org.intellij.lang.annotations.JdkConstants$CursorType found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 8 Duplicate class org.intellij.lang.annotations.JdkConstants$FlowLayoutAlignment found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 9 Duplicate class org.intellij.lang.annotations.JdkConstants$FontStyle found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 10 Duplicate class org.intellij.lang.annotations.JdkConstants$HorizontalAlignment found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 11 Duplicate class org.intellij.lang.annotations.JdkConstants$InputEventMask found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 12 Duplicate class org.intellij.lang.annotations.JdkConstants$ListSelectionMode found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 13 Duplicate class org.intellij.lang.annotations.JdkConstants$PatternFlags found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 14 Duplicate class org.intellij.lang.annotations.JdkConstants$TabLayoutPolicy found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 15 Duplicate class org.intellij.lang.annotations.JdkConstants$TabPlacement found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 16 Duplicate class org.intellij.lang.annotations.JdkConstants$TitledBorderJustification found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 17 Duplicate class org.intellij.lang.annotations.JdkConstants$TitledBorderTitlePosition found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 18 Duplicate class org.intellij.lang.annotations.JdkConstants$TreeSelectionMode found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 19 Duplicate class org.intellij.lang.annotations.Language found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 20 Duplicate class org.intellij.lang.annotations.MagicConstant found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 21 Duplicate class org.intellij.lang.annotations.Pattern found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 22 Duplicate class org.intellij.lang.annotations.PrintFormat found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 23 Duplicate class org.intellij.lang.annotations.PrintFormatPattern found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 24 Duplicate class org.intellij.lang.annotations.RegExp found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 25 Duplicate class org.intellij.lang.annotations.Subst found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 26 Duplicate class org.jetbrains.annotations.Contract found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 27 Duplicate class org.jetbrains.annotations.Nls found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 28 Duplicate class org.jetbrains.annotations.NonNls found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 29 Duplicate class org.jetbrains.annotations.NotNull found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 30 Duplicate class org.jetbrains.annotations.Nullable found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 31 Duplicate class org.jetbrains.annotations.PropertyKey found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 32 Duplicate class org.jetbrains.annotations.TestOnly found in modules jetified-annotations-15.0.jar (org.jetbrains:annotations:15.0) and jetified-intellij_annotations.jar (intellij_annotations.jar) 33 34 Go to the documentation to learn how to Fix dependency resolution errors.
原因分析:
当时在网上各种文档也有所参考并没有解决我的问题,就仔细看了一下到底是什么类重复还是jar包重复。
随后仔细看build.gradle和libs有没有一样的类。
最终发现build.gradle下
dependencies { implementation 'org.jetbrains:annotations:15.0' }
ibs文件下的
intellij_annotations.jar
可能是这两个导致冲突
解决方案:
随后就删除了intellij_annotations.jar包在进行编译就好了
写文档时也没在继续实现地图定位逻辑直接记录问题,遇到问题后会继续发帖子的。
如有大牛看到此文章有什么不妥之处还请联系博主,博主及时改进。