【问题标题】:Error:Execution failed for task ':app:mergeDebugResources'. > -1错误:任务“:app:mergeDebugResources”执行失败。 > -1
【发布时间】:2016-08-03 04:28:13
【问题描述】:

每当我运行、制作或清理项目时,

Error:Execution failed for task ':app:mergeDebugResources'.> -1

这个错误信息出来了。

我已多次检查我的资源文件,没有出现致命错误。 只有png图标和xml文件。

我不知道'-1'是什么意思..

在我的主要 java 文件中,有“无法解析符号 R”的错误。

我的应用程序昨晚启动良好,但是当我今天早上醒来并运行 android studio 时,它失败了。

我该怎么办?

这是我的毕业作品

apply plugin: 'com.android.application'


 android {
compileSdkVersion 24
buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "com.exapmle.rantalk"
    minSdkVersion 21
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:support-v13:24.1.1'}

在下面,我添加了我的整个 gradle 输出,谢谢。

执行任务:[:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources]

按需配置是一项孵化功能。 增量java编译是一个孵化特性。 :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2411Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72411Library UP-TO-DATE :app:prepareComAndroidSupportCardviewV72411Library UP-TO-DATE :app:prepareComAndroidSupportDesign2411Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72411Library UP-TO-DATE :app:prepareComAndroidSupportSupportV132411Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42411Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2411Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl 最新 :app:compileDebugRenderscript 最新 :app:generateDebugBuildConfig 最新 :app:mergeDebugShaders 最新 :app:compileDebugShaders 最新 :app:generateDebugAssets 最新 :app:mergeDebugAssets 最新 :app:generateDebugResValues 最新 :app:generateDebugResources 最新 :app:mergeDebugResources 失败

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务 ':app:mergeDebugResources' 执行失败。

    -1

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。

构建失败

总时间:7.62 秒

【问题讨论】:

  • 尝试通过以下方式清理 android studio:点击 File 选择 Invalidates Cache/Restart 然后选择 Invalidates cache and Restart。
  • 您能否展示更多 Gradle 输出?
  • @cricket_007 我已将其添加到我的帖子中,谢谢。
  • @sonnv1368 我尝试了很多次..但它没有工作。
  • 抱歉,没有回复这个。你可以试试Run with --info or --debug option to get more log output

标签: android android-gradle-plugin


【解决方案1】:

:app:mergeDebugResources 可能会由于资源文件的问题而被抛出

【讨论】:

  • 我的图片名为“ic_chatting_white_24dp.png”。有问题吗?
  • 移除24dp并重建项目(drawable文件夹中不允许数字)
  • 我删除了所有 24dp,我的资源中没有数字和大写字母......但它仍然不起作用。
  • 你重建应用了吗??
  • 当然。我清理了项目,重建项目,使 android studio 无效并重新启动,甚至重新启动了我的计算机。
【解决方案2】:

现在我发现我的 styles.xml 文件有问题... 我删除了样式并重新制作,现在我的应用程序可以工作了。 感谢 cmets,伙计们。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-12
    • 2017-08-28
    相关资源
    最近更新 更多