Android Null指针

时间:2012-04-29 04:12:49

标签: android

这里到底发生了什么?试图找到null但无法到目前为止....我确定它是一个愚蠢的东西

04-29 06:04:03.845: E/AndroidRuntime(392): FATAL EXCEPTION: main
04-29 06:04:03.845: E/AndroidRuntime(392): java.lang.RuntimeException: Unable to instantiate application com.adamwhiles.tw33tz.appliaction.Tw33tzApplication: java.lang.ClassNotFoundException: com.adamwhiles.tw33tz.appliaction.Tw33tzApplication in loader dalvik.system.PathClassLoader[/data/app/com.adamwhiles.tw33tz-2.apk]
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.app.LoadedApk.makeApplication(LoadedApk.java:466)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3260)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.app.ActivityThread.access$2200(ActivityThread.java:117)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:969)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.os.Looper.loop(Looper.java:123)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.app.ActivityThread.main(ActivityThread.java:3683)
04-29 06:04:03.845: E/AndroidRuntime(392):  at java.lang.reflect.Method.invokeNative(Native Method)
04-29 06:04:03.845: E/AndroidRuntime(392):  at java.lang.reflect.Method.invoke(Method.java:507)
04-29 06:04:03.845: E/AndroidRuntime(392):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-29 06:04:03.845: E/AndroidRuntime(392):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-29 06:04:03.845: E/AndroidRuntime(392):  at dalvik.system.NativeStart.main(Native Method)
04-29 06:04:03.845: E/AndroidRuntime(392): Caused by: java.lang.ClassNotFoundException: com.adamwhiles.tw33tz.appliaction.Tw33tzApplication in loader dalvik.system.PathClassLoader[/data/app/com.adamwhiles.tw33tz-2.apk]
04-29 06:04:03.845: E/AndroidRuntime(392):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-29 06:04:03.845: E/AndroidRuntime(392):  at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-29 06:04:03.845: E/AndroidRuntime(392):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.app.Instrumentation.newApplication(Instrumentation.java:942)
04-29 06:04:03.845: E/AndroidRuntime(392):  at android.app.LoadedApk.makeApplication(LoadedApk.java:461)
04-29 06:04:03.845: E/AndroidRuntime(392):  ... 11 more

这是我的应用程序的应用程序类....

package com.adamwhiles.tw33tz.application;

import oauth.signpost.OAuthProvider;
import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
import twitter4j.Twitter;
import android.app.Application;

public class Tw33tzApplication extends Application {

    private Twitter twitter;

    /** @return the twitter */
    public Twitter getTwitter() {
        return twitter;
    }

    /** @param twitter
     *            the twitter to set */
    public void setTwitter(Twitter twitter) {
        this.twitter = twitter;
    }

    private OAuthProvider provider;
    private CommonsHttpOAuthConsumer consumer;

    /** @param provider
     *            the provider to set */
    public void setProvider(OAuthProvider provider) {
        this.provider = provider;
    }

    /** @return the provider */
    public OAuthProvider getProvider() {
        return provider;
    }

    /** @param consumer
     *            the consumer to set */
    public void setConsumer(CommonsHttpOAuthConsumer consumer) {
        this.consumer = consumer;
    }

    /** @return the consumer */
    public CommonsHttpOAuthConsumer getConsumer() {
        return consumer;
    }
}

以下是我申请的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.adamwhiles.tw33tz"
      android:versionCode="1"
      android:versionName="1.0">
      <uses-sdk android:minSdkVersion="10" />
      <uses-permission android:name="android.permission.INTERNET" /> 

    <application android:label="Tw33tz" android:name=".appliaction.Tw33tzApplication">
        <activity android:name=".AuthActivity" android:label="Tw33tz">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="callback" android:host="tw33tz" />
            </intent-filter>
        </activity>
        <activity android:name=".Tw33tzActivity"></activity>
    </application>
</manifest>
希望这会有所帮助......

1 个答案:

答案 0 :(得分:0)

它无法找到一个被认为应该能够的课程。我怀疑你没有在清单和代码中拼写一致的东西:

未完成的课程com.adamwhiles.tw33tz。 appliaction .Tw33tzApplication

来自清单

android:name=".appliaction.Tw33tzApplication"

vs the source提供

package com.adamwhiles.tw33tz.application;