Android编译时出现Process ‘command ‘build-tools\27.0.3\aapt.exe‘‘ finished with non-zero exit value 1报错

在Android Studio中编译时,gradle编译之后出现了如下错误:

1Error:Execution failed for task ':samples-simplevideowidget:processDebugResources'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Android\SDK\build-tools\23.0.1\aapt.exe'' finished with non-zero exit value 1

首先看到这个错误之后,先检查了下Android Studio项目中资源,代码有无提示的错误;

1)定位错误点

在项目root路径,实际上是控制台Terminal下也可以输入命令,命令行输入:

gradlew processDebugResources --debug

然后项目开始编译,屏幕上输出大量编译Log信息,从Log中找到了输出的出错信息:

1org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
2,org.gradle.process.internal.DefaultExecHandle] Process ‘command ‘E:\Android\SDK\build-tools\23.0.1\aapt.exe’’ finished with exit value 1 (state: FAILED)
3,org.gradle.api.Project] Unknown source file : ERROR: In ListItemLinearLayout, unable to find attribute singleLine
4,org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:samples-simplevideowidget:processDebugResources’
5,E] [class org.gradle.TaskExecutionLogger] :samples-simplevideowidget:processDebugResources FAILED

从上述Log信息,我们可知出错点是ERROR: In ListItemLinearLayout, unable to find attribute singleLine,那么肯定是attrs文件的ListItemLinearLayoutstyleable出错了。

2)错误原因

经过上述分析,我们进入attrs.xml文件,可以看出singleLine没有对应的format属性,确定singleLine没有在代码中使用之后,将此属性删掉。

重新编译之后,问题解决。

转载:https://blog.csdn.net/willba/article/details/83512363

猜你喜欢

转载自blog.csdn.net/qq_36961698/article/details/120440647