AAPT2 error in Android Studio 3.0.1

Akshat Chawla picture Akshat Chawla · Jan 30, 2018 · Viewed 12.1k times · Source

I'm trying to get a "hello world" application running using Android Studio 3.0.1 and get the following AAPT2 error output:

Error:(16) error: not well-formed (invalid token).
Error:(16) not well-formed (invalid token).
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details...

I was not able to find a solution, could someone please help me?

Answer

emilpmp picture emilpmp · Jul 6, 2018

android.enableAapt2=false Don't do this step to temporarily hide the issue. Aapt1 is going to be deprecated soon and Aapt2 has to be used by 2018 end.

This is just an issue with the gradle build tools. Just update your gradle and the gradle tools.

I am using classpath 'com.android.tools.build:gradle:3.3.0-alpha02'' inside dependency tag in Project level gradle and I am using gradle version 4.8 . This fixed the issue for me.

Additional Disable Instant run, if this didn't fix for you