3

After updating Android Studio, I get this error when building project:

enter image description here

and this:

enter image description here

How can I solve this problem?

Son Truong
  • 13,661
  • 5
  • 32
  • 58
KingoC
  • 167
  • 3
  • 15
  • Possible duplicate of [Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details](https://stackoverflow.com/questions/46988102/errorcom-android-tools-aapt2-aapt2exception-aapt2-error-check-logs-for-detail) – Gokul Nath KP Sep 14 '18 at 16:53
  • Can you go to the Terminal window and run "gradlew clean assembleDebug" and post the output here (make sure you include std err as well as std out)? Also could you list the files in app/build/intermediates? – Izabela Orlowska Sep 19 '18 at 11:12

5 Answers5

4

Try: Build -> Rebuild project .

Sos.
  • 914
  • 10
  • 14
2

Update your android Gradle plugin version in your build.gradle file to 3.2.0-alpha11 or newer it all compiles fine:

classpath 'com.android.tools.build:gradle:3.2.0-alpha11'
Anubhav Gupta
  • 2,492
  • 14
  • 27
0

You can either disable AAPT2 by setting android.enableAapt2=false in gradle.properties.

Or use 'com.android.tools.build:gradle:3.2.0-alpha11' or latest version.

More details: Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

Gokul Nath KP
  • 15,485
  • 24
  • 88
  • 126
  • when i added "android.enableAapt2=false" in "gradle.properties" i get this error : The option 'android.enableAapt2' is deprecated and should not be used anymore. Use 'android.enableAapt2=true' to remove this warning. It will be removed at the end of 2018.. – KingoC Sep 17 '18 at 13:55
0

I resolved it by deleting app/build folder and then rebuild.

0

If you have recently changed your namespace 'com.yourcompany.yourappname' and your current import to your resources 'com.yourcompany.your_app_name.R' doesn't match would also cause this error.

Make sure your namespace matches your imports

Allen
  • 301
  • 2
  • 4