的Javadoc在Eclipse中的Andr​​oid项目失败,并抛出NullPointerException [英] Javadoc for Android project in Eclipse fails with NullPointerException

查看:252
本文介绍了的Javadoc在Eclipse中的Andr​​oid项目失败,并抛出NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想产生在Eclipse的javadoc注释为我的Andr​​oid项目,但我不断收到一个NullPointerException异常。只有当我尝试生成Javadoc中导入 Android的兼容库(android.support类,会出现问题),这是我作为连接外部罐子。我也参考了Android 2.2和几个库项目,但这些不会导致这个错误自己。

I am trying to generate javadoc comments in Eclipse for my Android Project, but I keep getting a NullPointerException. The problem occurs only when I try to generate javadocs for classes that import the Android Compatibility Library (android.support), which I have attached as an external jar. I also reference Android 2.2 and several Library Projects, but those do not cause this error on their own.

Loading source file /home/travisc/Desktop/Android/App/workspace/Restaurant/src/com/yellowbrickcode/restaurant/StartupActivity.java...
Constructing Javadoc information...
StartupActivity.java:3: package android.content does not exist
import android.content.ContentValues;
                      ^
StartupActivity.java:4: package android.content does not exist
import android.content.Intent;
                      ^
StartupActivity.java:5: package android.content does not exist
import android.content.SharedPreferences;
                      ^
StartupActivity.java:6: package android.content.SharedPreferences does not exist
import android.content.SharedPreferences.Editor;
                                        ^
StartupActivity.java:7: package android.os does not exist
import android.os.Bundle;
                 ^
StartupActivity.java:8: package android.preference does not exist
import android.preference.PreferenceManager;
                         ^
StartupActivity.java:10: package android.view does not exist
import android.view.Menu;
                   ^
StartupActivity.java:11: package android.view does not exist
import android.view.MenuItem;
                   ^
StartupActivity.java:12: package android.view does not exist
import android.view.View;
                   ^
StartupActivity.java:14: package android.view does not exist
import android.view.ViewGroup;
                   ^
StartupActivity.java:15: package android.widget does not exist
import android.widget.ImageButton;
                     ^
StartupActivity.java:27: cannot access android.app.Activity
class file for android.app.Activity not found
public class StartupActivity extends FragmentActivity {
       ^
StartupActivity.java:29: cannot find symbol
symbol  : class OnClickListener
location: class com.yellowbrickcode.restaurant.StartupActivity
    private OnClickListener mMenuListener = new OnClickListener() {
            ^
StartupActivity.java:38: cannot find symbol
symbol  : class OnClickListener
location: class com.yellowbrickcode.restaurant.StartupActivity
    private OnClickListener mAccountListener = new OnClickListener() {
            ^
StartupActivity.java:49: cannot find symbol
symbol  : class OnClickListener
location: class com.yellowbrickcode.restaurant.StartupActivity
    private OnClickListener mCheckinListener = new OnClickListener() {
            ^
StartupActivity.java:68: cannot find symbol
symbol  : class Menu
location: class com.yellowbrickcode.restaurant.StartupActivity
    public boolean onCreateOptionsMenu(Menu menu) {
                                       ^
StartupActivity.java:74: cannot find symbol
symbol  : class MenuItem
location: class com.yellowbrickcode.restaurant.StartupActivity
    public boolean onOptionsItemSelected(MenuItem item) {
                                         ^
StartupActivity.java:80: cannot find symbol
symbol  : class Bundle
location: class com.yellowbrickcode.restaurant.StartupActivity
    protected void onCreate(Bundle savedInstanceState) {
                            ^
PushService.java:14: package org.json does not exist
import org.json.JSONException;
               ^
PushService.java:16: package android.app does not exist
import android.app.AlarmManager;
                  ^
PushService.java:17: package android.app does not exist
import android.app.IntentService;
                  ^
PushService.java:18: package android.app does not exist
import android.app.Notification;
                  ^
PushService.java:19: package android.app does not exist
import android.app.NotificationManager;
                  ^
PushService.java:20: package android.app does not exist
import android.app.PendingIntent;
                  ^
PushService.java:21: package android.content does not exist
import android.content.BroadcastReceiver;
                      ^
PushService.java:22: package android.content does not exist
import android.content.Context;
                      ^
PushService.java:23: package android.content does not exist
import android.content.Intent;
                      ^
PushService.java:24: package android.content does not exist
import android.content.SharedPreferences;
                      ^
PushService.java:25: package android.content.SharedPreferences does not exist
import android.content.SharedPreferences.Editor;
                                        ^
PushService.java:26: package android.os does not exist
import android.os.Binder;
                 ^
PushService.java:27: package android.os does not exist
import android.os.IBinder;
                 ^
PushService.java:28: package android.os does not exist
import android.os.SystemClock;
                 ^
PushService.java:29: package android.preference does not exist
import android.preference.PreferenceManager;
                         ^
PushService.java:30: package android.util does not exist
import android.util.Log;
                   ^
RemoteUpdater.java:13: package org.json does not exist
import org.json.JSONArray;
               ^
RemoteUpdater.java:14: package org.json does not exist
import org.json.JSONException;
               ^
RemoteUpdater.java:15: package org.json does not exist
import org.json.JSONObject;
               ^
RemoteUpdater.java:17: package android.content does not exist
import android.content.ContentResolver;
                      ^
RemoteUpdater.java:18: package android.content does not exist
import android.content.ContentValues;
                      ^
RemoteUpdater.java:20: package android.database does not exist
import android.database.Cursor;
                       ^
RemoteUpdater.java:21: package android.database does not exist
import android.database.SQLException;
                       ^
RemoteUpdater.java:23: package android.net does not exist
import android.net.Uri;
                  ^
RemoteUpdater.java:24: package android.util does not exist
import android.util.Log;
                   ^
PushService.java:54: cannot find symbol
symbol: class IntentService
public class PushService extends IntentService implements Saveable {
                                 ^
PushService.java:681: cannot find symbol
symbol  : class Binder
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    protected class PushBinder extends Binder {
                                       ^
PushService.java:178: cannot find symbol
symbol  : class Context
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    public boolean clear(Context ctx) {
                         ^
PushService.java:190: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    public IBinder onBind(Intent intent) {
                          ^
PushService.java:190: cannot find symbol
symbol  : class IBinder
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    public IBinder onBind(Intent intent) {
           ^
PushService.java:205: cannot find symbol
symbol  : class Context
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    public boolean restore(Context ctx) {
                           ^
PushService.java:228: cannot find symbol
symbol  : class Context
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    public boolean save(Context ctx) {
                        ^
PushService.java:254: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    protected void onHandleIntent(Intent intent) {
                                  ^
PushService.java:357: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void receiveMessage(Intent intent) {
                                ^
PushService.java:393: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void receiveRegistration(Intent intent) throws JSONException {
                                     ^
PushService.java:393: cannot find symbol
symbol  : class JSONException
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void receiveRegistration(Intent intent) throws JSONException {
                                                           ^
PushService.java:416: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void register(Intent intent) {
                          ^
PushService.java:456: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void retryAction(Intent intent) {
                             ^
PushService.java:498: cannot find symbol
symbol  : class JSONException
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void unregister() throws JSONException{
                                     ^
PushService.java:523: cannot find symbol
symbol  : class JSONException
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void unregisterServer(String regId) throws JSONException{
                                                       ^
PushService.java:545: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void updateRegistration(Intent intent) throws JSONException {
                                    ^
PushService.java:545: cannot find symbol
symbol  : class JSONException
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    private void updateRegistration(Intent intent) throws JSONException {
                                                          ^
RemoteUpdater.java:72: cannot find symbol
symbol  : class ContentValues
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private ArrayList<ContentValues> mInsertedRecords;
                      ^
RemoteUpdater.java:77: cannot find symbol
symbol  : class ContentValues
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private ArrayList<ContentValues> mInsertedMappings;
                      ^
RemoteUpdater.java:86: cannot find symbol
symbol  : class ContentResolver
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private ContentResolver mResolver;
            ^
RemoteUpdater.java:97: cannot find symbol
symbol  : class ContentResolver
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    public RemoteUpdater(String authority, ContentResolver resolver) {
                                           ^
RemoteUpdater.java:192: cannot find symbol
symbol  : class JSONObject
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private boolean updateNewsFeed(JSONObject serverData) {
                                   ^
RemoteUpdater.java:207: cannot find symbol
symbol  : class JSONObject
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private boolean updateTable(JSONObject serverData, Uri authority,
                                ^
RemoteUpdater.java:207: cannot find symbol
symbol  : class Uri
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private boolean updateTable(JSONObject serverData, Uri authority,
                                                       ^
RemoteUpdater.java:208: cannot find symbol
symbol  : class JSONException
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
            String table, String date) throws JSONException {
                                              ^
RemoteUpdater.java:234: cannot find symbol
symbol  : class JSONObject
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private boolean updateMenu(JSONObject serverData) {
                               ^
RemoteUpdater.java:308: cannot find symbol
symbol  : class Uri
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private boolean commitUpdates(Uri authority, String table, String date) {
                                  ^
RemoteUpdater.java:365: cannot find symbol
symbol  : class JSONArray
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
    private void parseRecords(JSONArray records, boolean delete)
                              ^
RemoteUpdater.java:366: cannot find symbol
symbol  : class JSONException
location: class com.yellowbrickcode.restaurant.c2dm.RemoteUpdater
            throws JSONException {
                   ^
PushService.java:612: cannot find symbol
symbol  : class BroadcastReceiver
location: class com.yellowbrickcode.restaurant.c2dm.PushService
    public static class Receiver extends BroadcastReceiver {
                                         ^
PushService.java:629: cannot find symbol
symbol  : class Context
location: class com.yellowbrickcode.restaurant.c2dm.PushService.Receiver
        public void onReceive(Context context, Intent intent) {
                              ^
PushService.java:629: cannot find symbol
symbol  : class Intent
location: class com.yellowbrickcode.restaurant.c2dm.PushService.Receiver
        public void onReceive(Context context, Intent intent) {
                                               ^
SyncPreferences.java:10: package android.os does not exist
import android.os.Bundle;
                 ^
SyncPreferences.java:11: package android.preference does not exist
import android.preference.PreferenceActivity;
                         ^
SyncPreferences.java:23: cannot find symbol
symbol: class PreferenceActivity
public class SyncPreferences extends PreferenceActivity {
                                     ^
SyncPreferences.java:27: cannot find symbol
symbol  : class Bundle
location: class com.yellowbrickcode.restaurant.c2dm.SyncPreferences
    protected void onCreate(Bundle savedInstanceState) {
                            ^
Provider.java:5: package android.content does not exist
import android.content.ContentProvider;
                      ^
Provider.java:6: package android.content does not exist
import android.content.ContentValues;
                      ^
Provider.java:7: package android.content does not exist
import android.content.UriMatcher;
                      ^
Provider.java:8: package android.database does not exist
import android.database.Cursor;
                       ^
Provider.java:9: package android.database.sqlite does not exist
import android.database.sqlite.SQLiteDatabase;
                              ^
Provider.java:10: package android.graphics.drawable does not exist
import android.graphics.drawable.Drawable;
                                ^
Provider.java:11: package android.net does not exist
import android.net.Uri;
                  ^
Provider.java:12: package android.util does not exist
import android.util.Log;
                   ^
Provider.java:41: cannot find symbol
symbol: class ContentProvider
public class Provider extends ContentProvider {
                              ^
Provider.java:51: cannot find symbol
symbol  : class Uri
location: class com.yellowbrickcode.restaurant.database.Provider
    public static final Uri CONTENT_URI = 
                        ^
Provider.java:57: cannot find symbol
symbol  : class Uri
location: class com.yellowbrickcode.restaurant.database.Provider
    public static final Uri MENU_URI = Uri.withAppendedPath(CONTENT_URI, UpdateType.menu.toString());
                        ^
Provider.java:62: cannot find symbol
symbol  : class Uri
location: class com.yellowbrickcode.restaurant.database.Provider
    public static final Uri NEWS_FEED_URI = Uri.withAppendedPath(CONTENT_URI, Table.NEWS_FEED.name);
                        ^
Provider.java:65: cannot find symbol
symbol  : class Uri
location: class com.yellowbrickcode.restaurant.database.Provider
    public static final Uri UPDATES_URI = Uri.withAppendedPath(CONTENT_URI, Table.UPDATE_LOG.name);
                        ^
Provider.java:70: cannot find symbol
symbol  : class Uri
location: class com.yellowbrickcode.restaurant.database.Provider
    public static final Uri IMAGE_URI =  Uri.withAppendedPath(CONTENT_URI, Table.IMAGE.name);
                        ^
Provider.java:80: cannot find symbol
symbol  : class UriMatcher
location: class com.yellowbrickcode.restaurant.database.Provider
    private static final UriMatcher URI_MATCHER;
                         ^
DatabaseHelper.java:3: package android.content does not exist
import android.content.ContentValues;
                      ^
DatabaseHelper.java:5: package android.database.sqlite does not exist
import android.database.sqlite.SQLiteDatabase;
                              ^
DatabaseHelper.java:6: package android.database.sqlite does not exist
import android.database.sqlite.SQLiteOpenHelper;
                              ^
DatabaseHelper.java:7: package android.graphics does not exist
import android.graphics.Bitmap;
                       ^
DatabaseHelper.java:8: package android.util does not exist
import android.util.Log;
                   ^
DatabaseHelper.java:21: cannot find symbol
symbol: class SQLiteOpenHelper
public class DatabaseHelper extends SQLiteOpenHelper {
                                    ^
Standard Doclet version 1.6.0_23
Building tree for all the packages and classes...
java.lang.NullPointerException
    at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:85)
    at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:47)
    at com.sun.tools.javadoc.ClassDocImpl.superclassType(ClassDocImpl.java:486)
    at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:405)
    at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:443)
    at com.sun.tools.doclets.internal.toolkit.util.ClassTree.processType(ClassTree.java:180)
    at com.sun.tools.doclets.internal.toolkit.util.ClassTree.buildTree(ClassTree.java:132)
    at com.sun.tools.doclets.internal.toolkit.util.ClassTree.<init>(ClassTree.java:91)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:123)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)
    at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)
    at com.sun.tools.doclets.standard.Standard.start(Standard.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:291)
    at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:165)
    at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:374)
    at com.sun.tools.javadoc.Start.begin(Start.java:162)
    at com.sun.tools.javadoc.Main.execute(Main.java:59)
    at com.sun.tools.javadoc.Main.main(Main.java:49)
100 warnings

的关键问题是在底部的错误 - 100警告只涉及链接到主的Andr​​oid库的文档,这是一个独立的问题,做的没有的原因没有提及的错误android.support。事实上,没有任何警告,说任何类似的包android.support不存在。这使我相信javadoc的是找到兼容性库,但一些涉及我引用,当涉及到最终的Javadoc生成它导致一个错误的罐子或方式。

The key problem is the error at the bottom. - The 100 warnings only involve linking to the main Android library documentation, which is a separate issue that does not cause the error without reference to android.support. In fact, none of the warnings say anything resembling "package android.support does not exist". This leads me to believe the javadoc is finding the compatibility library, but that something involving the jar or the way I reference it is causing an error when it comes to final javadoc generation.

任何有关什么可能导致错误的想法是AP preciated。

Any ideas about what might be causing the error are appreciated.

推荐答案

我有同样的错误。通过选择在向导中的项目的不同部分的错误有时会触发,有时没有。

I had the same error. By selecting different parts of the project in the wizard the error would sometimes trigger and sometimes not.

无论如何,这个错误之前有很多的包机器人。*不存在的警告,所以我决定摆脱这些第一。 <一href="http://stackoverflow.com/questions/5200234/javadoc-in-eclipse-failing-to-recognize-packages/8182949#8182949">Here's解决方法是为我工作。

Anyway, before that error there's a lot of "package android.* does not exist" warnings, so I decided to get rid of these first. Here's the workaround that worked for me.

现在,这些警告消息走了, NullPointerException异常消失了呢!我能为整个项目生成javadoc的,其中包含指向引用的库项目,第三方的jar包和Android框架类。

Now, with these warning messages gone, the NullPointerException disappeared too! I was able to generate javadoc for the entire project, including links to referenced library projects, 3rd party library jars and Android framework classes.

这篇关于的Javadoc在Eclipse中的Andr​​oid项目失败,并抛出NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆