Execution failed for task ‘:app:processDebugResources’.
今天编译Android项目时报错,大概提示如下:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'.
......
Caused by: org.gradle.tooling.BuildException: Failed to process resources, see aapt output above for details.
......
Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt
......
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
......
Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
......
Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
分析
从提示信息看:是编译时编译失败,但没有具体提示。
此种情况一般是:1. targetSdkVersion、buildToolVersion版本问题。有些文件或属性别的版本不匹配编译出错;2. xml文件中错误。依据xml生成对象时出错;
解决办法
首先:通过gradlew build命令,定位到具体信息。(此命令可以看到编译时的具体信息,Mac系统命令:./gradlew build)这是能看到编译失败的具体问题。
其次:解决该问题。完工。