Android Studio 3.0 migration AAPT2 error

2019-01-27 20:44发布

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

3条回答
Anthone
2楼-- · 2019-01-27 21:24

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

android.enableAapt2=false

enter image description here

查看更多
神经病院院长
3楼-- · 2019-01-27 21:26

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"

查看更多
Animai°情兽
4楼-- · 2019-01-27 21:45

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

查看更多
登录 后发表回答