uni-app中提供的aar文件打包报错显示高德版本冲突,如何查看uni的高德插件版本jar包
uni-app中提供的aar文件打包报错显示高德版本冲突,如何查看uni的高德插件版本jar包
Appid: `UNI`BA4C525
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':app:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.amap.api.fence.DistrictItem found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.fence.DistrictItem$1 found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.fence.GeoFence found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.fence.GeoFence$1 found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.fence.GeoFenceClient found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.fence.GeoFenceListener found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.fence.PoiItem found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.fence.PoiItem$1 found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocation found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocation$1 found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClient found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClientOption found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClientOption$1 found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClientOption$2 found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationMode found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationProtocol found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationPurpose found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationClientOption$GeoLanguage found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationListener found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
> Duplicate class com.amap.api.location.AMapLocationQualityReport found in modules AMap_Location_V5.2.0_20200915 (AMap_Location_V5.2.0_20200915.jar) and uniplugin_module-release-runtime (uniplugin_module-release.aar)
应该是在他们的打包服务器上
可以帮忙解决冲突和指导,之前有做过,联系QQ:1804945430
在uni-app中处理aar文件打包时遇到高德版本冲突的问题,通常需要通过查看和对比项目中引入的高德SDK版本与uni-app官方插件中使用的版本。以下是一些步骤和代码示例,帮助你定位和解决问题。
步骤一:检查uni-app项目中的高德SDK版本
-
查看项目依赖: 首先,检查你的
package.json
文件中是否直接引入了高德SDK的npm包。如果有,记录下版本号。{ "dependencies": { "@amap/amap-jsapi": "版本号" } }
-
检查
manifest.json
: 查看manifest.json
中是否配置了高德插件,并记录下插件的版本。{ "mp-weixin": { "usingComponents": true, "plugins": { "amap-wx": { "version": "版本号", "provider": "高德地图官方" } } } }
步骤二:查看uni-app官方插件中的高德版本
-
下载官方插件源码: 如果可能,尝试下载uni-app官方高德插件的源码,通常可以在uni-app的官方仓库或社区中找到。
-
检查插件中的
build.gradle
: 在插件的Android源码中,查找build.gradle
文件,查看其中高德SDK的依赖版本。dependencies { implementation 'com.amap.api:3dmap:版本号' // 其他依赖 }
步骤三:对比和解决版本冲突
-
对比版本: 将步骤一和步骤二中得到的版本号进行对比,找出冲突的版本。
-
统一版本: 根据对比结果,选择一个兼容的版本,并在项目中统一使用该版本。如果需要修改,可以在项目的
build.gradle
或AndroidManifest.xml
中强制指定版本。configurations.all { resolutionStrategy.force 'com.amap.api:3dmap:统一版本号' }
-
重新打包: 清理并重新打包项目,确保没有版本冲突。
npm run dev:%PLATFORM% -- --clean
通过上述步骤,你应该能够查看并统一uni-app项目中高德SDK的版本,从而解决打包时遇到的版本冲突问题。如果问题依然存在,建议查看uni-app和高德地图的官方文档或社区,寻求更具体的帮助。