Execution failed for task ':app:transform Dex Archive With ExternalLibs Dex MergerFor Debug'.

我在接入阿里云的hotfix热修复时运行项目出现了:

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
BUILD FAILED in 8s

通过查找我发现是build.gradle里面出现了相同的依赖包引用或者是lib里的jar文件引用重复了,或者不同的包有包含的关系!
知道问题就好办了:
1,看看是否有重复的依赖包,有的话删除一个
2,

android {
    defaultConfig {
       multiDexEnabled true
    }

开启dex合并(但是我一开始是开启了的还是报这个错误)
以上两个在我的代码都排除了没有问题,那就是不同的包或者不同的jar文件,或者依赖包与jar包有包含关系,然后我就开始找果然找到了,原来是阿里的utdid包重复了因为我的项目中介入了支付宝支付,这两个sdk中都包含了utdid这个包然后就把这个包在移动热修复中的依赖剔除掉.

implementation('com.aliyun.ams:alicloud-android-hotfix:3.2.8') {
        exclude(module: 'alicloud-android-utdid')
    }

阿里云文档中也有这个的解决办法:https://help.aliyun.com/knowledge_detail/59152.html?spm=a2c4g.11186623.2.10.5313174aHlWk7x
写的不好 ,纯属个人问题错误的记录,以此加深印象!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值