Eclipse中的Javadoc for Android项目给出了NullPointerException

时间:2012-08-24 08:13:49

标签: android javadoc

我正在尝试在Eclipse中为我的Android项目生成JavaDoc注释,但我一直在获得NullPointerException。只有当我尝试为导入Android兼容性库(android.support)的类生成JavaDoc时才会出现问题,我已将其作为外部jar附加。我还引用了Android 2.2和几个Library Projects,但这些不会导致这个错误。

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

1 个答案:

答案 0 :(得分:5)

您好我找到了这个问题的解决方案,您只需要做两个步骤:

(1):生成一个javadoc.xml(创建一个新的txt&gt;保存为javadoc.xml)

(2):在Run&gt; cmd&gt;并转到保存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>