Apparently, the android
plugin doesn't add a compileJava
task (like the java
plugin would). You can check which tasks are available with gradle tasks --all
, and pick the right one for your (otherwise correct) dependency declaration.
EDIT:
Apparently, the android
plugin defers creation of tasks in such a way that they can't be accessed eagerly as usual. One way to overcome this problem is to defer access until the end of the configuration phase:
gradle.projectsEvaluated {
compileJava.dependsOn(generateSources)
}
Chances are that there is a more idiomatic way to solve your use case, but quickly browsing the Android plugin docs I couldn't find one.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…