android.content.ActivityNotFoundException:无法找到显式活动类[greendroid]

时间:2012-08-07 07:30:24

标签: android android-activity greendroid

我尝试用greendroid做一个应用程序,但我遇到了问题,我不知道如何解决它... 在这个时候,我已经尝试了我在网上找到的所有东西,但没有解决我的问题......

如果有人知道什么是错的......

MainApplication.java:

package com.example.testtt;
import greendroid.app.GDApplication;
    public class MainApplication extends GDApplication {
        @Override
        public Class<?> getHomeActivityClass() {
            return MainApplication.class;
        }
    }
}

MainActivity.java:

package com.example.testtt;

import greendroid.app.GDActivity;
import android.os.Bundle;

public class MainActivity extends GDActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_main);
    }

}

和清单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.testtt"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="15" />

    <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"
         android:theme="@style/Theme.GreenDroid" android:name="com.example.testtt.MainApplication">
        <activity
            android:name="com.example.testtt.MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

我有这个错误:

    08-07 07:27:53.717: W/dalvikvm(631): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
    08-07 07:27:53.717: E/AndroidRuntime(631): Uncaught handler: thread main exiting due to uncaught exception
    08-07 07:27:53.727: E/AndroidRuntime(631): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.testtt/com.example.testtt.MainApplication}; have you declared this activity in your AndroidManifest.xml?
    08-07 07:27:53.727: E/AndroidRuntime(631):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
    08-07 07:27:53.727: E/AndroidRuntime(631):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
    08-07 07:27:53.727: E/AndroidRuntime(631):  at android.app.Activity.startActivityForResult(Activity.java:2749)

1 个答案:

答案 0 :(得分:0)

在您的应用程序MainActivity.class中返回getHomeActivityClass()