天天看点

Gradle build error, Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug

导入的项目很老,所以出现这个问题,最下面两种我弄完才看见,没有试过,不过 stack overflow 很多人说有用,你们可以尝试下

stack overflow上的解决办法

我当时 project.gradle 配置如下:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module      

1. 把 gradle 版本改到 1.2.3’ 就可以正常编译了

2. Try adding multiDexEnabled true to your app build.gradle file

defaultConfig {
    multiDexEnabled true      

3. added it into build.gradle

android {
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'