Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed
For no reason, ./gradlew clean build -x lint -x test
fix the issue while ./gradlew clean assembleDebug
did not and reproduce the issue.
I am also facing this issue. I have tried all the above answers but not working. I have checked these are the questions and their answers. Question 1, Question 2, Question 3 and I have tried to install Windows Universal C Runtime library also.
I have tried to set the Gradle plugin version 3.5.0 and Gradle version 5.1.0 or 5.6.1 but then also not working. I have checked this google tracker issue also then also not got the answer.
After spending almost 6 to 7 hours I got the solution and it is below:
Project level build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is gradle-wrapper.property file:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
I hope someone will get help.
When building on Jenkins, if GRADLE_USER_HOME is not specified, it will try to dump the Gradle cache in System32 folder which causes this issue. Changing to a different directory via System Environment variable resolves the issue.
Project level gradle update classpath:
classpath 'com.android.tools.build:gradle:3.4.0'
gradle-wrapper.properties update distributionUrl:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
After these steps delete .iml
file from your project directory and rebuild the project
For further detail please see attached image
it was working but it not use updated gradle 3.4.0
enter image description here
You might consider disabling the aaptOptions
like the following. Add this in the android
section in your build.gradle
file.
android {
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
And add the following line in your gradle.properties
file.
android.enableAapt2=false