-3

I have spent almost two weeks now just trying to run my android game. Every time I run it on my phone from Eclipse it crashes and says "The process closed unexpectedly, please try again" or something like that. I created a new project with just an activity and other basic classes to see what the problem was, and I still get the message. I am not new to Java but am new to android, and I am having a very hard time debugging. I always get this error:

11-16 14:15:55.613: D/AndroidRuntime(9468): Shutting down VM
11-16 14:15:55.613: W/dalvikvm(9468): threadid=1: thread exiting with uncaught exception (group=0x4001d570)
11-16 14:15:55.613: E/AndroidRuntime(9468): FATAL EXCEPTION: main
11-16 14:15:55.613: E/AndroidRuntime(9468): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.stickman.revolution/com.example.stickman.revolution.MainActivity}: java.lang.ClassNotFoundException: com.example.stickman.revolution.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stickman.revolution-2.apk]
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.os.Looper.loop(Looper.java:130)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.app.ActivityThread.main(ActivityThread.java:3683)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at java.lang.reflect.Method.invokeNative(Native Method)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at java.lang.reflect.Method.invoke(Method.java:507)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at dalvik.system.NativeStart.main(Native Method)
11-16 14:15:55.613: E/AndroidRuntime(9468): Caused by: java.lang.ClassNotFoundException: com.example.stickman.revolution.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.stickman.revolution-2.apk]
11-16 14:15:55.613: E/AndroidRuntime(9468):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-16 14:15:55.613: E/AndroidRuntime(9468):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
11-16 14:15:55.613: E/AndroidRuntime(9468):     ... 11 more

Here is the manifest:

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

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

<application 
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

4

1 回答 1

1

您正在获取ClassNotFoundExceptionMainActivity,因此无法启动 Activity。检查您的 Android Manifest 并查看您的 Activity 是否已注册。

于 2012-11-16T20:44:20.380 回答