When I generate javadoc for my Android project in Eclipse, there are lots of warnings like
cannot find symbol symbol : class TextView
and
warning - Tag @see: reference not found: android.app.Dialog
I also tried
-link http://developer.android.com/reference/ -link http://java.sun.com/j2se/1.4.2/docs/api/
in Extra javadoc options (path names with white spaces must be enclosed in quotes)
tab in Configure Javadoc Arguments
(3rd dialog of eclipse->project->Generate Javadoc).
But only -link http://java.sun.com/j2se/1.4.2/docs/api/
is working i.e for String class link http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html?is-external=true
is generated. but for android.app.Dialog
, no link is generated.
Edit
I also tried selecting android.jar
in Select referenced archives and projects to which links should be generated
tab in Configure Javadoc arguments for standard doclet
(2nd dialog of eclipse->project->Generate Javadoc), but this creates local links to docs in local android-sdk directory, NOT the online Android references like it does for Java APIs.
Javadoc provides the @link inline tag for referencing the members in the Java classes. We can think of the @link tag as similar to the anchor tag in HTML, which is used to link one page to another via hyperlinks. Similar to the anchor tag, the path_to_member is the destination, and the label is the display text.
@see <a href="URL#value">label</a> : Adds a link as defined by URL#value . The URL#value is a relative or absolute URL. The Javadoc tool distinguishes this from other cases by looking for a less-than symbol ( < ) as the first character.
The @link tag is specifically used to link to the Javadoc of other classes and methods.
Javadoc relies on a file called package-list
to determine what Java packages are documented below a given directory. For some reason, such a file is missing for http://d.android.com/reference/, therefore the "naive" approach with
-link http://d.android.com/reference/
doesn't work – you get a warning that the package-list could not be retrieved and no links are generated into your docs. (Note: The checkboxes in that 2nd eclipse dialog just assemble -link
parameters for you, so that doesn't really make any difference)
However, Javadoc offers the -linkoffline
parameter to be able to adjust for precisely this situation: You want to link to some other Javadoc documentation online, but you cannot access it at the time of generating your own docs. Here's how it works: While -link
takes only one parameter (the URL of the JavaDoc docs you want to link to), -linkoffline
takes a second one. That one is the location of the package-list
file!
So, to link to the online Android reference documentation, you should not select any checkboxes in the 2nd eclipse dialog, but instead add
-linkoffline http://d.android.com/reference file:/C:/pathtoyour/android-sdk-windows/docs/reference
in the Extra Javadoc options in the 3rd dialog. That way you use the package-list
of your locally installed Android docs, but the links in your generated Javadoc will still point to the online version anyway.
Hope it helps!
By now (August 2020), Google has published a package-list
on its Android developer documentation. Hence, simply linking to https://developer.android.com/reference/ or https://d.android.com/reference/ will work (just tried this with success).
Minor glitch: if you open the generated Javadoc and try to follow a link to an Android class (or one of the standard Java classes, which will also link to the Android documentation) and you are in frame mode, your browser might refuse to follow the link, as the Android site does not allow embedding in another page. Firefox then gives you the alternative of opening the target document in a new tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With