In my android application I need to generate source code and use it in the app.
For that I created task genSources (using tutorials) for source generati
With gradle 2.2+ this should work:
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn genSources
}
If you also want it to happen when you evaluate (e.g. when syncing your project with gradle in android studio) you can do it like this:
gradle.projectsEvaluated {
preBuild.dependsOn genSources
}