Reputation: 83
I have published Android libraries in a private Artifactory like so. Javadoc is generated and published as a jar file together with the aar library to artifactory.
However, when using the library from another Android Studio project, the javadoc is not automatically showing in Android Studio quick documentation.
Upon a little more trial and errors, it seems that javadoc will be shown in the quick documentation of Android Studio if the library is not obfuscated during publishing
How can I go about publishing my obfuscated library and show javadoc without additional configuration in Android Studio for library users?
[Edit]
The published library files are:
aar, javadoc.jar, sources.jar, pom file
Currently, the sources.jar allows developers to reverse engineer the un-obfuscated source code, but still does not provide the javadoc for the library.
Upvotes: 6
Views: 1297
Reputation: 24907
First of all, you need to ensure that you are not obfuscating public APIs of your library.
By default the javadoc for a library is not downloaded until specified explicitly. You need to put following config in application's main build.gradle
idea {
module {
downloadJavadoc = true
}
}
Sync project with gradle file by clicking on Sync Now link from top right or by clicking following icon: Sync Project with gradle file
Android studio will download the javadoc and link it with your API appropriately.
If the javadoc is still not visible then try to invalidate cache and restart android studio from: File > Invalidate Caches/ Restart > Invalidate and Restart.
Upvotes: 0
Reputation: 4230
You need to do 'sources' release as well. If i understand you correctly, you want the developer which uses your aar to be able to see the documentation of the class with your notes.
In your gradle file, create a 'source' job like so :
task javadocTask(type: Jar) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesTask(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
//Or exact project path if you don't have sourceSets : from "YOUR_PROJECT/src/main/java"
}
artifacts {
archives sourcesTask
archives javadocTask
}
Upvotes: 2