I got this error while trying to build an Android app:

Execution failed for task ':admin:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-4.1.0-6503028-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
This should not happen under normal circumstances, please file an issue if it does.

Most other solutions I found were related to an image in the project being too large however, that didn't work for me as all my images had sizes below 50kb.

6

There are 6 answers

4
Schnelldev On BEST ANSWER

I found that this error occurs when additional modules are created in the project and linked to other app modules (using implementation project) but the plugin in the module's build.gradle file is set to 'com.android.application' instead of 'com.android.library'.

I found this solution in an answer to a different issue here.

0
Eli On

For me the issue was the compileSdkVersion. it was set as:
compileSdkVersion 34 (like my target version).

I fixed the issue by setting it to 33: compileSdkVersion 33

0
Vidurajith Darshana On

when upgrading the target SDK version to 34, I also set the compile SDK version to the same 34. Then I changed it as below.

    buildToolsVersion = "31.0.0"
    minSdkVersion = 21
    compileSdkVersion = 33
    targetSdkVersion = 34
1
Mayank Pandit On

I had a similar error when I tried upgrading the compileSdk and targetSdk versions to 34 (From 33).

What I had to do was to change my gradle plugin version from

classpath 'com.android.tools.build:gradle:4.2.2'

to

classpath 'com.android.tools.build:gradle:7.1.2'

I don't know what exactly is the issue here yet. But I got the idea from the Google's documentation. It does not specifically say to upgrade gradle plugin version but I sensed it from the section where they have mentioned about how to write compileSdk in AGP higher than 7.0.0 as compared to lower than 4.2.0.

I was so confused as to what happens to the AGP versions in between. But I thought of upgrading a AGP to higher than 7.0.0 and it worked fine.

If someone gets a better explanation of why this is the case, please comment. Thanks

0
MUCHIRA JUNIOR On

In flutter 3.19 i update the build script dependencies to the following

dependencies {
    classpath 'com.android.tools.build:gradle:7.3.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

the second dependency line is not involved

0
Сергей Беляков On

The answer from user "Schnelldev" can be shortened: for the application, the plugin 'com.android.application' should be used, and for each individual module 'com.android.library'