Thanks to this thread, I was able to get Javadoc links to work for my Android project within Eclipse on Windows. Specifically, \"{@link android.widget.Toast}\" is currently
Adding -classpath
parameter in the last screen of "Generate Javadoc..." wizard did not work for me: I got an error message saying that -classpath
parameter can only be specified once.
Not really a solution, but a workaround:
javadoc.xml
file in project directoryjavadoc.xml
file and edit classpath attribute. Specifically, add "/path/to/sdk/platforms/android-##/android.jar" there and any other jars that you get warning messages aboutant -buildfile javadoc.xml
. For convenience, I put this line in a javadoc.sh
shell script.You need to put the android classes in your javadoc classpath, too. For this, add the android jar file to the -classpath
argument of javadoc (as you would do for your compiler).
I have no idea whether and where Eclipse gives you some configuration option for this, though.
Project > generate Javadoc. Then, go to "Configure Javadoc arguments" and in VM options add "-bootclasspath /path/to/sdk/platforms/android-##/android.jar".
Worked for me :)
This workaround in eclipse worked for me:
Windows Eclipse solution
Adding the android.jar
to -classpath is indeed the correct approach. No ANT is necessary, though also viable. In case you want to be using Eclipse GUI (File->Export->Java->Javadoc) for generating Javadoc, there's no option to edit classpath in the dialog. You need to have the classpath set correctly beforehand. Two ways to achieve that:
Edit manually the <path_to_your_project>/.classpath
and add the following line:
<classpathentry kind="lib" path="<path_to_your_android_skd>/platforms/android-<version>/android.jar"/>
Right click on your project->Properties->Java Build Path->Libraries->Add External JARs->navigate to <path_to_your_android_skd>/platforms/android-<version>/android.jar
I found the Eclipse GUI approach better than using ANT hinted in some of the answers here because you get clickable references to your source code on any Javadoc warning/error in Console. When using ANT all you get in Console is printed output of the javadoc.exe command.
Thanks to answer provided by @PaŭloEbermann and @MarcelD-B, I was able to understand the root cause of the issue. However, since I am using Android Studio
, I was bit confused as to where to add the argument.
After some time, I was able to figure it out finally and I am putting it as an answer here for any other person who finds the similar issue.
For Android Studio
, open Tools > Generate JavaDocs
and add the following argument
in Other command line arguments:
-
-bootclasspath /path/to/sdk/platforms/android-##/android.jar
Note:- There's no need of adding any commas in the argument.
However, if your SDK Path
contains spaces then enclose the path in double quotes ("
). eg- My SDK Path
contains spaces so I used the argument
-
-bootclasspath "F:\Android SDK\platforms\android-21\android.jar"