8

After migrating my existing project to Android Studio 3.0, it is not compiling. Below are the log details:

Error:java.util.concurrent.ExecutionException: 
    java.util.concurrent.ExecutionException: 
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: 
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for 
details
Error:Execution failed for task ':app:processDebugResources'.
Failed to execute aapt
Information:BUILD FAILED in 27s
Information:11 errors
Information:0 warnings
Gaurav Singh
  • 2,200
  • 16
  • 30
user8806859
  • 83
  • 1
  • 1
  • 5

3 Answers3

14

Go to your gradle.properties write the below code and Sync your project

android.enableAapt2=false

enter image description here

Naveed Ahmad
  • 6,627
  • 2
  • 58
  • 83
Gaurav Singh
  • 2,200
  • 16
  • 30
  • `Process 'command 'C:\Users\PC\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1 ` after applying the above method. Any guess? – meyasir Nov 15 '18 at 09:06
4

Is your username in OS cyrillic? If so - you need to change the .gradle resource folder in settings to path which does not contain cyrillic symbols. In ->Settings-> Build, Execution -> Gradle change Service directory path to "C:/Users/Public/.gradle"

Leo240
  • 766
  • 7
  • 16
  • I also have a non-English character in my path and have the same problem. When I tried your suggestion, I get many errors, such as `error: resource android:attr/fontStyle not found.` Upon examination I see that the .gradle directory is over 900MB. I cannot add the suggested row to `gradle.properties` because I don't such that file in one of my projects. There's another called `settings.gradle` but adding the row there gives other errors. – Scott Johansen Feb 02 '18 at 02:15
  • If you can't find gradle.properties in your project, just create it as an empty file in the project's top level directory and add the setting to it. – kb1000 Apr 07 '18 at 16:21
0

this problem occur when there is something wrong in your XMl file

1:- remove all unnecessary XML files from your code

2:- Reopen and Check XML files

If there is Still Problem

Go to your gradle.properties write the below code

android.enableAapt2=false 

and then Go to your build.gradle(app) write the below code and Sync your project

aaptOptions {
        cruncherEnabled = false
    }

Like this Image

Note android.enableAapt2=false is deprecated, and will be removed by the end of 2018, so this doesn't solve the problem, is just a temporary workaround