【记一次错误排查】Caused by: org.gradle.process.internal.ExecException

问题:

编译和clean都无法完成。invalidate and restart无法解决。报错信息中包含以下内容:

Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Android\SDK\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1
at com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:573)

排查:

第一步:使用gradlew

在终端中运行./gradlew build 和 ./gradlew clean。查看报错信息。发现抱错的任务为“processDebugResources”。

第二步:使用gradlew运行报错任务

./gradlew android:processDebugResources --info

产看报错信息。发现报错内容很多为“No resource identifier found for attribute 'layout_constraintBottom' in package”。

第三步:查找ConstraintLayout的内容

网络上找到的方法在我这里都不适用。最后发现SDK中ConstraintLayout相关库没有安装导致。

以下安装完成后,问题解决。

后记:善用 gradlew 命令排查问题。

猜你喜欢

转载自blog.csdn.net/u012218652/article/details/90210207