执行失败应用程序:processDebugResources Android Studio

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20737200/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:22:28  来源:igfitidea点击:

Execution failed app:processDebugResources Android Studio

androidandroid-studiobitbucket

提问by danieljohngomez

I'm using bitbucket so I can work with other developer but it seems that we can't get it to work flawlessly. I got this error after pulling the changes from him:

我正在使用 bitbucket,所以我可以与其他开发人员合作,但似乎我们无法让它完美地工作。从他那里提取更改后,我收到此错误:

Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    E:\Program Files (x86)\Android\android-sdk\build-tools.0.0\aapt.exe package -f --no-crunch -I E:\Program Files (x86)\Android\android-sdk\platforms\android-19\android.jar -M E:\Documents\smart-my-job1\app\build\manifests\debug\AndroidManifest.xml -S E:\Documents\smart-my-job1\app\build\res\all\debug -A E:\Documents\smart-my-job1\app\build\assets\debug -m -J E:\Documents\smart-my-job1\app\build\source\r\debug -F E:\Documents\smart-my-job1\app\build\libs\app-debug.ap_ --debug-mode --custom-package com.smartmyjob
Error Code:
    -1073741819

采纳答案by marfy4207

For me it helped to change the version of buildTools to:

对我来说,将 buildTools 的版本更改为:

buildToolsVersion "21.0.1"

You will find this setting inside the file app/build.gradle.

您将在文件中找到此设置app/build.gradle

回答by Scott Barta

You're hitting bug https://code.google.com/p/android/issues/detail?id=42752. The cause usually seems to be a reference to a nonexistent string in one of your menu resources.

您遇到了错误https://code.google.com/p/android/issues/detail?id=42752。原因通常似乎是对菜单资源之一中不存在的字符串的引用。

回答by dirkk0

For me it was that I forgot to install the 32bit dependencies:

对我来说,是我忘记安装 32 位依赖项:

sudo apt-get install -y lib32gcc1 libc6-i386 lib32z1 lib32stdc++6
sudo apt-get install -y lib32ncurses5 lib32gomp1 lib32z1-dev lib32bz2-dev

回答by audiebant

aapt is 32 bit so will not execute on a 64 bit box until 32 bit architecture is enabled

aapt 是 32 位,因此在启用 32 位架构之前不会在 64 位机器上执行

dpkg --print-foreign-architectures  #  if prints nothing then below is fix

sudo dpkg --add-architecture i386  #  add a 32 bit architecture to box

sudo apt-get install -y lib32gcc1 libc6-i386 lib32z1 lib32stdc++6

sudo apt-get install -y lib32ncurses5 lib32gomp1 lib32z1-dev

it work for me.

它对我有用。

回答by Dico

I had the same problem and fixed it doing a ./gradlew clean build! Give it a try and if that doesn't work, try ./gradlew --refresh-dependenciesafter and you should be good to go.

我遇到了同样的问题并修复了它./gradlew clean build!试一试,如果这不起作用,再试一次./gradlew --refresh-dependencies,你应该很高兴。

回答by Abundant Ideas

My answer may seem a bit too late, but i happened to come across this same error in Android Studio after upgrading the SDK to API 21. I tried all the solutions i came across here on this site and https://code.google.com/p/android/issues/detail?id=61308. Here's how i eventually resoled this error: I opened the app's gradle.build file and changed it from this:

我的回答似乎有点晚了,但在将 SDK 升级到 API 21 后,我碰巧在 Android Studio 中遇到了同样的错误。我尝试了在此站点和https://code.google上遇到的所有解决方案。 com/p/android/issues/detail?id=61308。以下是我最终解决此错误的方法:我打开了应用程序的 gradle.build 文件并将其更改为:

android {
    compileSdkVersion 21
    buildToolsVersion "21.0.0"

    defaultConfig {
        applicationId "com.abundantideas.layoutsample"
        minSdkVersion 8
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }

to that:

对此:

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.abundantideas.layoutsample"
        minSdkVersion 8
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }

I lowered the buildToolsVersion and the targetSdkVersion values back to 20 which i knew was working fine before the upgrade. It looks like API 21 was causing problems for Gradle, in my case. I hope this will help others too.

我将 buildToolsVersion 和 targetSdkVersion 值降低回 20,我知道在升级之前它工作正常。就我而言,看起来 API 21 给 Gradle 带来了问题。我希望这也能帮助其他人。

回答by Akeshwar Jha

In my case, I cleaned the project (Menubar -> Build -> Clean Project) and then did the build again. It worked.

就我而言,我清理了项目(菜单栏 -> 构建 -> 清理项目),然后再次进行构建。有效。

回答by EdgeDev

In my case i had two declaration of

就我而言,我有两个声明

<?xml version="1.0" encoding="utf-8"?>

in my vector drawable icon

在我的矢量可绘制图标中

all i had to do was delete one

我所要做的就是删除一个

回答by Md. Ibrahim

In my Case Problem solved with Instant Run Disable in Android Studio 3.1.2 Android Instant Raun Disable

在我的案例中,在 Android Studio 3.1.2 中使用 Instant Run Disable 解决了问题 Android Instant Raun 禁用

回答by koteswara D K

it may help in the android studio 3.2.1 app build gradle it should be like

它可能有助于 android studio 3.2.1 app build gradle 它应该像

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.sample.mvphelloworld"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
       implementation fileTree(dir: 'libs', include: ['*.jar'])
       compile 'com.android.support:appcompat-v7:27.1.1'
       implementation 'com.android.support.constraint:constraint-layout:1.1.3'
       testImplementation 'junit:junit:4.12'
       androidTestImplementation 'com.android.support.test:runner:1.0.2'
       androidTestImplementation 'com.android.support.test.espresso:espresso- 
       core:3.0.2'
}

Gradle to 4.6
plugin version to 3.2.1

Gradle 到 4.6
插件版本到 3.2.1