Gradle-, Javadoc- und Android-Dokumentation
Ich benutze Gradle jetzt für alle meine Projekte und sogar für die Javadoc-Generation.
android.libraryVariants.all { variant ->
task("generate${variant.name}Javadoc", type: Javadoc) {
title = "$name $version API"
source = variant.javaCompile.source
ext.androidJar = "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
ext.googlePlayServicesJar = "${android.plugin.sdkDirectory}/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
classpath = files(variant.javaCompile.classpath.files, ext.androidJar, ext.googlePlayServicesJar)
options.links("http://docs.oracle.com/javase/7/docs/api/");
options.links("http://d.android.com/reference/");
//options.linksOffline("http://d.android.com/reference", "${android.plugin.sdkDirectory}/docs/reference");
exclude '**/BuildConfig.java'
exclude '**/R.java'
}
}
Mit diesem Code habe ich alles zum Laufen gebracht, bis auf eines: normale Android-API-Objekte wie Activity, Bitmap usw. Javas Links funktionieren einwandfrei.
Die endgültig erstellte Dokumentation funktioniert nichtVerknüpfung zuhttp://d.android.com/reference. Ich habe beide options.links () und versuchtoptions.linksOffline()
ohne Erfolg.
BEARBEITEN
Dank @ejb bestand das Problem darin, dass Sie nicht mehrere bereitstellen könnenoptions.links()
gleichzeitig. Also habe ich beides benutztoptions.links()
für Javas Dokumentation undoptions.linksOffline()
für die Dokumentation von Android:
options {
links("http://docs.oracle.com/javase/7/docs/api/");
linksOffline("http://d.android.com/reference", "${android.plugin.sdkDirectory}/docs/reference");
//stylesheetFile = new File(projectDir, "stylesheet.css");
}