简体   繁体   English

Android上的Javadoc(Eclipse)

[英]Javadoc on Android (Eclipse)

I am trying to generate Javadoc html pages for my Android project in Eclipse. 我试图在Eclipse中为我的Android项目生成Javadoc html页面。 I have tried using the -linkoffline argument, as suggested here , as well as using the -classpath argument pointing to my android.jar file. 我已尝试使用-linkoffline参数,如此处所示 ,以及使用指向我的android.jar文件的-classpath参数。 Neither of these worked, as I still get package android.app does not exist (and other) warnings. 这些都package android.app does not exist ,因为我仍然得到package android.app does not exist (和其他)警告。 I have also tried running the javadoc tool from the command line, rather than using Eclipse. 我也尝试从命令行运行javadoc工具,而不是使用Eclipse。

Ideally I would like to have my own generated pages for my classes, with all android.* and java.* classes linking to the online pages. 理想情况下,我想为我的类创建自己生成的页面,所有android。*和java。*类都链接到在线页面。 I am using Mac OS 10.6 with Java version 1.6.0_20. 我使用的是Mac OS 10.6和Java版本1.6.0_20。

While trying to resolve a similar issue myself, the two main points I've found have been: 在尝试自己解决类似问题时,我发现的两个要点是:

  • To include the android.jar file you're linking to within the classpath attribute of the javadoc Ant task. 要包含您在javadoc Ant任务的classpath属性中链接的android.jar文件。 That means something like the following: 这意味着类似以下内容:

     <javadoc ... classpath="some/local/library.jar; C:/Android/platforms/android-8/android.jar; D:/another/library.jar" ... > 
  • To add a link subitem under javadoc task in order to match the online Android Reference URL with a local copy of Android Reference package-list . 在javadoc任务下添加链接子项,以便将在线Android参考URL与Android参考包列表的本地副本相匹配。 That means something like the following: 这意味着类似以下内容:

     <javadoc ...> <link offline="true" href="http://developer.android.com/reference/" packagelistloc="C:/Android/docs/reference" /> </javadoc> 

This was enough for me in order to show Android links within my project Javadoc. 这足以让我在我的项目Javadoc中显示Android链接。

Have you tried using an ant script for the javadocs? 您是否尝试过为javadocs使用ant脚本? Name it javadoc.xml or something other than build.xml - else eclipse will pick it up as the default build script. 将其命名为javadoc.xmlbuild.xml之外的其他内容 - 否则eclipse会将其作为默认构建脚本。 Run the ant script either from inside eclipse ( RMB on file | Run As | Ant Build ), or from the console: ant -f <file-name.xml> . 从eclipse( RMB on file | Run As | Ant Build )或从控制台运行ant脚本: ant -f <file-name.xml>

Mine looks something similar to this: 我看起来像这样:

<project basedir="." default="doc" name="metagloss api docs">

    <property 
        name="android-sdk-docs"
        value="/home/blackrax/opt/dev/android-sdk-linux_86/docs/reference"/>

    <target name="doc" description="api docs - no piwik" depends="clean, delombok">
        <javadoc destdir="docs">
            <link offline="true"
                  href="http://d.android.com/reference"
                  packagelistLoc="${android-sdk-docs}" />
            <fileset dir="src" includes="**/*.java" />
        </javadoc>
    </target>

    <!-- more implementation, any remaining targets -->
</project>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM