【问题标题】:Gradle sync issue Error:Execution failed for task ':app:mergeDebugResources'Gradle同步问题错误:任务':app:mergeDebugResources'的执行失败
【发布时间】:2016-01-06 12:23:20
【问题描述】:

我是安卓新手, 当我通过 gradle 文件构建时它显示错误 错误:任务“:app:mergeDebugResources”执行失败。 部分文件处理失败,详情请查看日志

:app:mergeDebugResources 失败

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.application.animalfacechanger"
        minSdkVersion 15
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'org.apache.httpcomponents:httpcore:4.4.1'
}
android { sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/res/assets'] } } }
android { sourceSets { main { res.srcDirs = ['src/main/res', 'src/main/res/color'] } } }

【问题讨论】:

  • 设置compileSdkVersion 23 & 设置targetSdkVersion 23
  • 或者只能设置buildToolsVersion "22.0.2"
  • 仍然没有用 @IntelliJAmiya 我已经尝试过了。
  • 谢谢我会检查..!!!
  • 感谢您的帮助...!!终于解决了……!!!

标签: android android-studio gradle adt


【解决方案1】:

我知道这个问题很老,但是,为了像我这样在面临同样问题时遇到/将会遇到这个问题的人,我决定提供对我有用的解决方案。 从 Gradle 3.4 开始,您需要 Java 8 及更高版本。 将此添加到您的应用级别 build.gradle 文件

...

android {
    ...
    defaultConfig {
        ...
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            ...
        }
    }
}

 ...

清理您的项目并运行应用程序。

【讨论】:

    【解决方案2】:

    针对您的mergeDebugResources问题。

    起初评论compile 'com.android.support:support-v4:22.0.0' 并使用buildToolsVersion "22.0.2"

    android {
    compileSdkVersion 22
    buildToolsVersion "22.0.2"
    
    defaultConfig {
        applicationId "com.application.animalfacechanger"
        minSdkVersion 15
        targetSdkVersion 22
    }
    

    然后构建-清理-重建项目。我希望它会帮助你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-09
      • 1970-01-01
      • 2020-12-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多