您的位置:首页 > 产品设计 > UI/UE

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

2017-11-13 11:36 796 查看
报错如下:

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

项目中出现的原因

同一个依赖项目,多次compile,导致merge dex 失败

具体是这样

compile('com.github.afollestad.material-dialogs:core:0.8.5.2@aar') {
transitive = true
}


然后又依赖同一项目的top version导致

compile 'com.afollestad.material-dialogs:core:0.9.5.0'


要其一即可

还有top version 使用了高compileSDK

要在project的build.gradle加入最新的sdk高版本脚本,强制所有module一律使用高版本

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.0.0'
}
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐