Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDex报错

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34709057/article/details/78692810

原来的项目可以正常运行的,但升级到AndroidStudio 3.0后就有问题了。APP在Clear时没有报错,但一安装到手机上就报错了。
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

上网找了很多方法都不行(而新建的项目却可以调试),最后只好新建一个项目,将旧项目的代码转移过去了。新项目可以安装了,也没有报错了,最后新旧项目对比后才发现不同点在于:旧项目在AS升级时build.gradle中的classpath变成3.0.0了

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
最后将旧项目的classpath改为原来的
classpath 'com.android.tools.build:gradle:2.3.1'

就正常了。






猜你喜欢

转载自blog.csdn.net/qq_34709057/article/details/78692810
今日推荐