Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Josephine Een
Josephine Een
13,202 Points

Android Studio problem with AAPT2

Hi! I keep getting this compile error, even if it's a new clean project. I succeed to resolve the issue with writing this code to the .gradle.properties "android.enableAapt2=false". But now when I have updated the program which is Android Studio, it wont let me run my app and says that I need to put the Aapt2 to true, but then I get the "Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details". I have looked online, but I am at loss. I have tried number of times to clean the build and rebuild without success.

Thanks in advanced !

Ben Deitch
Ben Deitch
Treehouse Teacher

Hmm... does it say anything in the logs? And does it fail if you only try to build the app? Also, you could try File -> Invalidate Caches/Restart; that sometimes fixes things.

2 Answers

Josephine Een
Josephine Een
13,202 Points

Thanks for the answer!

It also happens when I tried just to run the app in the emulator. The log files doesn't lead me anywhere, maybe cause I pretty new to programming at least this kind of a problem. I tried what you suggested, but I'm still getting the error. Even tried to uninstall and reinstall Android Studio. But when I use the gradle build, i get this error message:

"FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':app:mergeDebugResources'.

Error: 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. "

I tried with --stacktrace but it led to more errors + my first problem with AAPT2.

Ben Deitch
Ben Deitch
Treehouse Teacher

Well that's not good. I'm not entirely sure what's going wrong, but the 3rd answer (with the update) on this SO question might be something else to try. Other than that, if you put the project on GitHub and share a link, I can see if I get the same issue.

Josephine Een
Josephine Een
13,202 Points

I succeded to resolve the problem with downgrading the Andriod Studio version to an older version. I am now using Android Studio 3.0, and I dont get the AAPT2 error. The problem I have now is that my application is using a different version of API, it says. To solve that I just started a new Project and continue on.

Im quiet new to this asking for help, and using the "answer" and commenting system on treehouse, so sorry about the mess. And also for my English isnt as good as it could have been to describe the problem I am having xD.

But thank you for taking the time to help me with this problem. I heared that they will remove the AAPT2 at the end of 2018, I hope that it will resolve the problem in the future.