Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerExcept

由于自己项目有很多第三方依赖,导致dex文件合并失败,解决方法

在Module下的build.gradle中添加 multiDexEnabled true

defaultConfig{

        multiDexEnabled true

}

dependencies{ 

compile'com.android.support:multidex:1.0.2'

}

在Application中重写

@Override

protected voidattachBaseContext(Context base) {

super.attachBaseContext(base);

MultiDex.install(mContext);

}

你可能感兴趣的:(Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerExcept)