AndroidRunTime错误,应用程序意外停止

时间:2015-07-10 08:33:29

标签: android eclipse android-emulator

07-10 08:32:43.863: E/AndroidRuntime(718): FATAL EXCEPTION: main
07-10 08:32:43.863: E/AndroidRuntime(718): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.burp/com.example.burp.MainActivity}: java.lang.ClassNotFoundException: com.example.burp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.burp-2.apk]
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.os.Looper.loop(Looper.java:123)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.app.ActivityThread.main(ActivityThread.java:3683)
07-10 08:32:43.863: E/AndroidRuntime(718):  at java.lang.reflect.Method.invokeNative(Native Method)
07-10 08:32:43.863: E/AndroidRuntime(718):  at java.lang.reflect.Method.invoke(Method.java:507)
07-10 08:32:43.863: E/AndroidRuntime(718):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-10 08:32:43.863: E/AndroidRuntime(718):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-10 08:32:43.863: E/AndroidRuntime(718):  at dalvik.system.NativeStart.main(Native Method)
07-10 08:32:43.863: E/AndroidRuntime(718): Caused by: java.lang.ClassNotFoundException: com.example.burp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.burp-2.apk]
07-10 08:32:43.863: E/AndroidRuntime(718):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
07-10 08:32:43.863: E/AndroidRuntime(718):  at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
07-10 08:32:43.863: E/AndroidRuntime(718):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-10 08:32:43.863: E/AndroidRuntime(718):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
07-10 08:32:43.863: E/AndroidRuntime(718):  ... 11 more

我该如何解决这个问题?我正在使用Windows 7

1 个答案:

答案 0 :(得分:0)

将您的活动包含在清单文件中。喜欢这个

<activity
        android:name=".application's starting activity"  <!-- (.)dot means current dir, if your activity is in another package then give full package name ex: com.xxx.Activity  -->
        android:label="LABEL FOR ACTIVITY "
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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