AAPT2 gradle issue in android studio 3.0 beta4

12,962

Solution 1

For me, there was no need to add android.enableAapt2=false to my gradle.properties. The solution for me was to make sure that in my gradle build file my compileSdkVersion is set to 26, buildToolsVersion is set to 26.0.2 and targetSdkVersion is set to 26.

Note: In my build file, I had to do this check for all target and compile sdkVersions including product flavors:

  • mobile
  • tv

I am using Android Studio 3.0.1.

Solution 2

For anyone who is still having issues, i.e loading up demos etc or importing projects. You need to make sure (like everyone else has stated):

You add the following statement to your gradle.properties file

android.enableAapt2=false

Now here is for the bit that they should have filled you in on. Chances are if you have imported a project there may not be a gradle.properties file this can be for a wide range of reasons old gradles being used auto fixing issues on build etc.

But seriously, If you can't find it right click in gradle scripts and click on new resource bundle and type gradle. This will create a gradle.properties just paste that code there and run the program. I would not use this as a permanent work around. I stumbled across this whilst importing a project that didn't have a gradle attached to the folder, normally making an app from scratch will have the properties file there.

Solution 3

Solved it mate finally

please update your compileSdkVersion to 26.That will solve your issue.I think so

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

i have Solved it with increasing compileSDKVersion to 26

Solution 4

In my case it was caused by this line being missing from the Gradle dependencies:

implementation 'com.android.support.constraint:constraint-layout:1.1.0'

Solution 5

For Cordova developers those working on android studio
I had faced this issue while changing the support library from com.android.support:appcompat-v7:23.0.0 to com.android.support:appcompat-v7:27.1.1 in order to support the foreground service feature of Android Oreo; to solve this add the following lines of code in build.gradle file `

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
    minSdkVersion 26
    targetSdkVersion 27
      }
} 

After that comment following lines of code in build.gradle file. **Most important

cdvCompileSdkVersion cdvCompileSdkVersion
buildToolsVersion cdvBuildToolsVersion

Rebuild the project.

Share:
12,962
Ramkailash
Author by

Ramkailash

PROFESSIONAL SUMMARY:-> As a senior Enterprise Programmer with 6 years of IT industry working experience in developing Enterprise applications using java(JavaEE), and related technologies, object-oriented analysis and design was demonstrated as summarized below and 2+ years of working experience in Design and Integrations using Mule ESB. Experience in all the phases of the SLDC, Client-Server and n-tires Architectures in domains like Finance and HealthCare . Expertise in implementing Service Oriented Architecture(SOA) in SOAP/RestFull web services in Mule. Designing RAML for different end points. Which is available for consumer applications to consume Creating HTTP inbounds and outbound flow, routing, Transformation and Securities of the Mule. Extensively used Mule components, which includes File, FTP, HTTP, SFTP, SMTP, DataBase Connectors, SalesForce, SAP, CXF, Invoke, Exception Handling etc.... If you need any clarification or any query. Please drop message. Solid knowledge in Java/J2EE technologies. Well experienced in MVC architecture, Spring, Spring Boot, Hibernate, JPA Experienced with different build tools, Maven, Ant and CI tools like Jenkins Experienced in using configurtion management tools, GIT, SVN Consumed Web services by implementing Spring REST support is to make the development of RESTFUL web services

Updated on September 07, 2022

Comments

  • Ramkailash
    Ramkailash almost 2 years

    enter image description hereError:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

    We have already added android.enableAapt2=false in gradle.properties file

  • IntelliJ Amiya
    IntelliJ Amiya over 6 years
    We have already added android.enableAapt2=false in gradle.properties file
  • Ramkailash
    Ramkailash over 6 years
    i have already checked with stable version but still facing same issue
  • Ghimire
    Ghimire over 6 years
    have you solved your issue.I am facing Similar problem just now
  • mac229
    mac229 over 6 years
    Are you using 9patches?
  • Ghimire
    Ghimire over 6 years
    @mac229 if you are saying to me , i am not using any 9 patches image. but updated project to Android Studio 3.0 and facing this issue
  • Ramkailash
    Ramkailash over 6 years
    We are facing this issue for last 6 hours before that same configuration was running fine. I have added different solutions but not working.
  • Ramkailash
    Ramkailash over 6 years
    Even we checked by updating android studio version but still facing same issue with stable version.
  • Ghimire
    Ghimire over 6 years
    Whats the main issue .I don't get it. @Ramkailash if you got solution ,please mention me also.that will be great help
  • Ramkailash
    Ramkailash over 6 years
    Could you please tell me Android Studio version?
  • Ramkailash
    Ramkailash over 6 years
    I have changed compileSDKVersion 26 and buildToolsVersion '26.0.2'. But still facing same issue.
  • Ghimire
    Ghimire over 6 years
    I have Android studio 3.0.Please remove the android.enableAapt2=false whaich you have added
  • Mafujul
    Mafujul over 6 years
    I am using 9patch images. When I want to use 9patch image I am facing this problem.
  • Ghostx0
    Ghostx0 over 6 years
    Read my comment it's about adding the gradle properties file, which no one has mentioned.
  • Enzokie
    Enzokie over 6 years
    That means you are answering a wrong question. The OP is not asking how to find the gradle.properties or how to create a gradle.properties in case if it is not found anywhere.
  • Ghostx0
    Ghostx0 over 6 years
    quite a toxic little fella aint yah
  • Enzokie
    Enzokie over 6 years
    Which part is toxic? Please don't interpret my previous comment badly, I am just actually trying to help.