高德地图jar包冲突原因
/*高德地图*/
//定位功能
"amap-location-latest" : "com.amap.api:location:latest.integration",
//搜索功能
"amap-search" : "com.amap.api:search:latest.integration",
//导航功能
//导航功能
"amap-navi-3dmap" : "com.amap.api:navi-3dmap:latest.integration",
amap-location-latest与amap-navi-3dmap冲突
报错:Duplicate class com.amap.api.fence.DistrictItem found in modules location-9.8.1 and navi-3dmap-9.8.1的jar包冲突最简单有效方法就是build.gradle的依赖
api rootProject.ext.dependencies["amap-location-latest"]
api rootProject.ext.dependencies["amap-search"]
api rootProject.ext.dependencies["amap-navi-3dmap"]
改为
compileOnly rootProject.ext.dependencies["amap-location-latest"]
api rootProject.ext.dependencies["amap-search"]
api rootProject.ext.dependencies["amap-navi-3dmap"]
如果大家使用implementation方式
implementation('com.amap.api:3dmap::latest.integration')
implementation('com.amap.api:location::latest.integration')
compileOnly 'com.google.code.gson:gson:2.6.2'
改成
compileOnly ('com.amap.api:location::latest.integration')
implementation('com.amap.api:3dmap::latest.integration')
就行!绝对有用!