Android gradle javadoc
Background
I develop Android SDK at work.
I want to make javadoc for SDK API. For SDK, I don’t want to show private API and not API methods.
So, I tried to make new task to generate javadoc only for SDK public API.
Sample
build.gradle Please add following any place to your build.gradle
android.libraryVariants.all { variant -> task generateJavadoc(type: Javadoc, overwrite: true) { title = "Reward SDK API" description "Generates JavaDoc." source = variant.javaCompile.source ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) failOnError = false include('com/atmarkplant/sdk/api/**.java'); options.links("https://docs.oracle.com/javase/8/docs/api/"); options.linksOffline("https://d.android.com/reference", "${android.sdkDirectory}/docs/reference") options.setMemberLevel(JavadocMemberLevel.PUBLIC); options.docEncoding("UTF-8"); options.encoding("UTF-8"); options.charSet("UTF-8"); } generateJavadoc.dependsOn(clearDoc) }
include is source target(only public API).
You can run gradle command.
gradle generateJavadoc
Or, double click Android Studio Gradle project panel.
After it, javadoc is under build/docs/javadoc/
options.linksOffline("https://d.android.com/reference", "${android.sdkDirectory}/docs/reference")
This part works when you have Android documentation on your local.
Problem
javadoc main documentation is inside of iframe. Android link and Oracle java link is outside of domain.
I could not jump directly inside and need to use another tab or window.