Android Studio编译失败:org.gradle.api.tasks.TaskExecutionException: Execution failed for task '

Android Studio编译报错:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':lib_umeng:verifyDebugProguardResources'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)

命令行中执行如下命令查看详细报错(需先切换到当前工程目录下):

  Windows: gradlew clean build --stacktrace

  MAC/Linux: ./gradlew clean build --stacktrace

查看详细的报错,发现存在如下报错:

D:\android\test\src\main\res\layout\umeng_customshare_layout.xml:9: AAPT: No resource identifier found for attribute 'layout_constraintEnd_toEndOf' in package 'com.umeng.message.lib'

D:\android\test\src\main\res\layout\umeng_customshare_layout.xml:9: AAPT: No resource identifier found for attribute 'layout_constraintStart_toStartOf' in package 'com.umeng.message.lib'

D:\android\test\src\main\res\layout\umeng_customshare_layout.xml:9: AAPT: No resource identifier found for attribute 'layout_constraintTop_toTopOf' in package 'com.umeng.message.lib'

D:\android\test\src\main\res\layout\umeng_customshare_layout.xml:25: AAPT: No resource identifier found for attribute 'layout_constraintTop_toBottomOf' in package 'com.umeng.message.lib'

从日志看,比较奇怪,这些属性是constraintlayout里的东东。这个工程是一个子工程,debug版本编译时没有问题,但是新增的一个编译类型debugProguard类型却报错了。因为build.gradle文件中确实没有添加constraintlayout依赖,所以添加一下。

解决方案:

添加constraintlayout依赖

implementation 'com.android.support.constraint:constraint-layout:1.1.3'

安卓开发技术分享:https://blog.csdn.net/yinxing2008/article/details/84555061

你可能感兴趣的:(安卓)