Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error-ThrowExceptions

Exception or error:

How can I solve this problem, when I am building it, it is showing me the same problem-
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

I am using classpath ‘com.android.tools.build:gradle:3.1.0’

What should be the exact solution. Please let me know as soon as possible.

How to solve:

There could be a problem in your res folders it could be an image that was not well converted so the solution to this is to update your gradle plugin which will highlight the actual problem

This line classpath 'com.android.tools.build:gradle:3.2.0-alpha18'

Edit your build.gradle file:

 buildscript {
    repositories {
        google() // important!
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
    }
}

allprojects {
    repositories {
        google() // important!
        jcenter()
    }
}

NOTE This might require to update your gradle to 4.6

###

I had the same issue. Apparently this line had to be at the top of the main XML file and was 2 or 3 lines below.

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

Cut and pasted to top of XML file and build succeeded.

###

  1. Open your build.gradle(app module)
  2. Please make sure you have buildToolsVersion available in your gradle file (if it is missing please make sure you have to add (buildToolsVersion) same version as of compileSdkVersion)

###

error: invalid file path 'F:\AK-Android-Code\ak-im\build\intermediates\manifests\aapt\enterpriseArmV7\release\output.json'.
error: invalid file path 'F:\AK-Android-Code\ak-im\build\intermediates\manifests\aapt\enterpriseArmV7\release\AndroidManifest.xml'.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ak-im:verifyEnterpriseArmV7ReleaseResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
65 actionable tasks: 6 executed, 59 up-to-date

In my case,error info as above.I delete file folder F:\AK-Android-Code\ak-im\build\intermediates\manifests\aapt\ then rebuild project and it is successful. You can use ‘gradlew –debug assembleRelease ’ check gradlew’s output info.

###

Error: java.util.concurrent.ExecutionException:
com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error:
check logs for details

Solve it in the following way in the Gradle:

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'+

this line

    aaptOptions.cruncherEnabled = false
    aaptOptions.useNewCruncher = false

###

I have the same problem as you and solved this problem this way:

First, bulid a new “hello world” project in Android Studio and make sure it can correctly run.
Then, open the build.gradle file to check the classpath. In my “hello world” project, the classpath is

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

And then open the gradle-wrapper.properties file to check the distributionUrl.In my “hello world” project, the distributionUrl is

distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

Finally, make the two configurations the same as “hello world” project in the imported project. The app could run correctly .

Leave a Reply

Your email address will not be published. Required fields are marked *