1

我正在尝试在 Eclipse 中为我的 Android 项目生成 JavaDoc 注释,但我不断收到NullPointerException. android.support仅当我尝试为导入 Android 兼容性库 ( 我还参考了 Android 2.2 和几个库项目,但它们本身不会导致此错误。

C:\Users\workspace\fm\src\com\fm\camera\UploadSubmissionSubmitPhotoVideo.java:9: package android.content does not exist

import android.content.Intent;
                      ^
Standard Doclet version 1.6.0_19
Building tree for all the packages and classes...
java.lang.NullPointerException
    at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:67)
    at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:29)
    at com.sun.tools.javadoc.ClassDocImpl.superclassType(ClassDocImpl.java:441)
    at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:386)
    at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:424)
    at com.sun.tools.doclets.internal.toolkit.util.ClassTree.processType(ClassTree.java:162)
    at com.sun.tools.doclets.internal.toolkit.util.ClassTree.buildTree(ClassTree.java:114)
    at com.sun.tools.doclets.internal.toolkit.util.ClassTree.<init>(ClassTree.java:73)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:104)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
    at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
    at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
    at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
    at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
    at com.sun.tools.javadoc.Start.begin(Start.java:128)
    at com.sun.tools.javadoc.Main.execute(Main.java:41)
    at com.sun.tools.javadoc.Main.main(Main.java:31)
100 warnings
4

1 回答 1

5

您好,我找到了这个问题的解决方案,您只需执行 2 个步骤:

(1):生成一个javadoc.xml(新建一个txt>另存为javadoc.xml)

(2) :在 Run > cmd > 中并转到保存 javadoc 文件的位置,触发如下命令:ant -f javadoc.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="C:\Users\workspace\fm\src\com\fm\APIClient" default="doc" name="api docs">
<target name="doc" description="my docs">
<javadoc destdir="C:\Users\workspace\fm\doc" doctitle="Testing the Title" verbose="on" 
    use="true" 
    classpath="F:\android SDK and eclipse\android-sdk-windows\platforms\android-10\android.jar;C:\Users\workspace\fm\libs

\android-query-full.0.22.10.jar;C:\Users\workspace\fm\libs\commons-httpclient-3.0.1.jar;C:\Users\workspace\fm\libs\gcm.jar;C:\Users\workspace\fm\libs\httpmime-4.1.jar;F:\android SDK and eclipse\android-sdk-windows\add-ons

\addon_google_apis_google_inc_8\libs\maps.jar"  
    sourcepath="C:\Users\workspace\fm\src;C:\Users\workspace\fm\gen"
    packagenames="com.fm.APIClient" 
    linkoffline="http://d.android.com/reference F:\android SDK and eclipse\android-sdk-windows\docs\reference"
    stylesheetfile="F:\android SDK and eclipse\android-sdk-windows\docs\assets\android-developer-docs.css"
    >
</javadoc>
</target>
</project>
于 2012-08-24T11:13:08.437 回答