Everything worked fine until I updated build gradle to 3.2.1 and now I cannot build my project. I have a task that generates some variant specific code as defined below:
applicationVariants.all { variant ->
def generateClientIdConfigTask = project.tasks.create(..)
....
variant.variantData.sourceGenTask.dependsOn generateClientIdConfigTask
}
This line is causing following error:
Caused by: groovy.lang.MissingPropertyException: No such property: sourceGenTask for class: com.android.build.gradle.internal.variant.ApplicationVariantData
I already updated distributionUrl in the gradle wrapper as below:
distributionUrl=https://services.gradle.org/distributions/gradle-4.6- all.zip
Any help would be appreciated. Is there a different way to write dependsOn
?
API android plugin was changed. You need to do this (replace variant.variantData.sourceGenTask
to variant.variantData.getTaskContainer().sourceGenTask
):
applicationVariants.all { variant ->
def generateClientIdConfigTask = project.tasks.create(..)
....
variant.variantData.getTaskContainer().sourceGenTask.dependsOn generateClientIdConfigTask
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.