how to fix 23.0.1\aapt.exe'' finished with

2020-02-01 06:59发布

All of a sudden I cannot get Gradle to build any projects under Android Studio.

Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '\Local\Android\sdk\build-tools\23.0.0\aapt.exe'' finished with non-zero exit value 1

My Gradle is

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "com.marathon.simplelist"
        minSdkVersion 8
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
}

Even if I create a new Blank Activity project I still get this error.

I have Android Studio 1.3.1 installed with

SDK Platforms: 5.X, 5.1, 5.0, 4.4, 2.3.3 SDK Tools: SDK Build Tools, SDK Tools 24.4, Platform-Tools 23.0.1

Obviously something is reconfigured locally since even a new empty project will not build. Ideas on how I can resolve this?

标签: android
27条回答
我命由我不由天
2楼-- · 2020-02-01 07:16

In my case, due to duplicated attributes in xml causes this issue. For example,

<TextView
android:id="@+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello"
android:text="Hello" />
查看更多
一纸荒年 Trace。
3楼-- · 2020-02-01 07:17

First try to clean and rebuild your project from Build menu.

Step 1: go to Build -> Clean Project

Step 2: go to Build -> Rebuild Project

This should solve your problem.

Otherwise try updating Android SDK build tool from SDK manager and modify your build.gradle to use latest buildToolsVersion i.e "23.0.2" as of now

查看更多
走好不送
4楼-- · 2020-02-01 07:18

Android studio only accepts images within a certain file name frame

Invalid file name: must contain only [a-z0-9_.]

I had a file by Korean. so I delete then It's worked!!!

查看更多
Rolldiameter
5楼-- · 2020-02-01 07:18

Change The buildToolsVersion To compileSdkVersion as Shown Below Code:...

Before: It Was Not Working....

android {
    compileSdkVersion 23
    buildToolsVersion '22.0.1'
    defaultConfig {
        applicationId 'com.kdmsl.kraapp'
        minSdkVersion 14
        versionCode 3
        versionName "1.3"
        aaptOptions {
            additionalParameters "--no-version-vectors"
        }
    }

After Changes:

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.0'
    defaultConfig {
        applicationId 'com.kdmsl.kraapp'
        minSdkVersion 14
        versionCode 3
        versionName "1.3"
        aaptOptions {
            additionalParameters "--no-version-vectors"
        }
    }
查看更多
家丑人穷心不美
6楼-- · 2020-02-01 07:18

In my case, I just used this 'android:drawableTop="2dp"' with a TextView. Obviously, it is an invalid reference. It is a good way to revert to the last git version when met with this problem.

查看更多
Explosion°爆炸
7楼-- · 2020-02-01 07:19

If someones is using react-native (and have updated it's version recently) and having this problem:

Quoting @chamchamgo:

I found the root cause is that old version's packager collect resources (image etc.) and put under $(rn_project)\android\app\src\main\res, while newer version put them under $(rn_project)\android\app\build\intermediates\res\merged\$(buildType). It brings duplication which leads to failure of task 'processReleaseResources'. And it also explains why new created project works well. When you have an old RN project upgrading to newer version, just delete directories like 'drawable-xxxx' (ATTN:no 'v?' postfix) under $(rn_project)\android\app\src\main\res and wolrd will be nice.

Check the whole thread at: https://github.com/facebook/react-native/issues/5787#issuecomment-236408669

查看更多
登录 后发表回答