Reputation: 840
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
?
Upvotes: 0
Views: 429
Reputation: 1380
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
}
Upvotes: 1