线程退出与未捕获的异常

时间:2012-08-02 02:02:35

标签: android

我首先实现系统和引擎多人游戏,然后能够调整所有导入和库并在MOTODEV中运行而没有任何错误,但模拟器“已意外停止”。

您可以看到code here

模拟器出错:

08-02 00:52:55.500: D/AndroidRuntime(330): Shutting down VM
08-02 00:52:55.500: W/dalvikvm(330): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-02 00:52:55.549: E/AndroidRuntime(330): FATAL EXCEPTION: main
08-02 00:52:55.549: E/AndroidRuntime(330): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.multiplayerand/com.multiplayerand.MainActivity}: java.lang.ClassNotFoundException: com.multiplayerand.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.multiplayerand-2.apk]
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.os.Looper.loop(Looper.java:123)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.app.ActivityThread.main(ActivityThread.java:4627)
08-02 00:52:55.549: E/AndroidRuntime(330):  at java.lang.reflect.Method.invokeNative(Native Method)
08-02 00:52:55.549: E/AndroidRuntime(330):  at java.lang.reflect.Method.invoke(Method.java:521)
08-02 00:52:55.549: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-02 00:52:55.549: E/AndroidRuntime(330):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-02 00:52:55.549: E/AndroidRuntime(330):  at dalvik.system.NativeStart.main(Native Method)
08-02 00:52:55.549: E/AndroidRuntime(330): Caused by: java.lang.ClassNotFoundException: com.multiplayerand.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.multiplayerand-2.apk]
08-02 00:52:55.549: E/AndroidRuntime(330):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
08-02 00:52:55.549: E/AndroidRuntime(330):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
08-02 00:52:55.549: E/AndroidRuntime(330):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
08-02 00:52:55.549: E/AndroidRuntime(330):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
08-02 00:52:55.549: E/AndroidRuntime(330):  ... 11 more

1 个答案:

答案 0 :(得分:1)

请注意日志中的这一行:

Unable to instantiate activity ComponentInfo{com.multiplayerand/com.multiplayerand.MainActivity}: java.lang.ClassNotFoundException: com.multiplayerand.MainActivity in loader dalvik.system.PathClassLoader

该行说明,您尝试instantiate activity它的名称为MainActivity且它位于com.multiplayerand pakage,但系统找不到任何包含此Component-info的Activity,并且所以java.lang。ClassNotFoundException已经发生了。

我想如果你能解决问题:

  • 检查您的活动名称是否为MainActivity
  • 检查MainActivity是否在名称为com.multiplayerand的包裹中。
  • 检查您是否在项目的manifest中注册了MainActivity。