Javadoc relies on a file calledpackage-listto determine what Java packages are documented below a given directory. For some reason, such a file ismissingforhttp://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-linkparameters for you, so that doesn't really make any difference)
However, Javadoc offers the-linkofflineparameter to be able to adjust for preciselythissituation: 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-linktakes only one parameter (the URL of the JavaDoc docs you want to link to),-linkofflinetakes a second one. That one is the location of thepackage-listfile!
So, to link to the online Android reference documentation, you shouldnotselect 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 theExtra Javadoc optionsin the 3rd dialog. That way you use thepackage-listof your locally installed Android docs, but the links in your generated Javadoc will still point to the online version anyway.
Hope it helps!

本文介绍如何使用Javadoc的-linkoffline参数正确链接到Android类引用文档。通过指定本地的package-list文件路径,同时保持链接指向在线文档的方式,解决无法生成有效链接的问题。

被折叠的 条评论
为什么被折叠?



