Error: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
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:
I am using Android Studio 3.0.1.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With