How can I generate JavaDocs for an Android project using the new Gradle build system?
Here is what I have come up with but it doesn't work.
task generateJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
ext.cp = android.libraryVariants.collect { variant ->
variant.javaCompile.classpath.files
}
classpath = files(ext.cp)
}
The main problem is that I do not get the appropriate android.jar on the classpath so some of the links in the JavaDocs are not resolved. I have to find a way to get all the necessary jars on the classpath.
Another problem with the approach I took is it collects the classpaths for all the build variants, rather than selecting one.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…