How to Fix Android Studio 3.1 Error Debugging Issue

I Wayan Dharmana
AndroidPub
Published in
2 min readApr 8, 2018

Android Studio 3.1 has been released on March 2018 (check here) with various of new features and also many improvements such as Incremental desugaring, SQL editing improvements with Room, Simplified output window, Improvement for Kotlin support and many more.

If you have upgrade to Android Studio 3.1, there’s one feature that changed. We can’t see Gradle Console on the bottom. It has been replaced by Build window which has Sync and Build tabs.

Gradle Console replaced with Build Window

I’ve update to Android Studio 3.1 and try my first debug to emulator. And…. WTF! It show error message but not tell me what’s wrong in my code.

com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

From here I have to guess what problem in my code. I check every code that i’ve write. But no error notice I found. I keep trying and trying. I do not feel I’ve spent 5 hours looking solution for this problem. And I try below solution on terminal.

./gradlew assemble --stacktrace --info

Finally, I get clue for my problem.

Run gradle command on terminal

But I think it still hard to find the problem. So, lets try the new solution. Now, go to Preferences > Build, Execution , Deployment > Compiler. Fil Command-line options field with below.

--stacktrace

And then click OK.

Compiler Setting

After that, lets try to build project to device / emulator. Wait and check the response.

I got you, problem!

Now I can get the problem in my code when I use Android Studio 3.1. Lets try and if you have another solution, let share on comment.

Thank you!

--

--