-1

我已经在这个项目上工作了几个星期了,突然间我得到了这个java.lang.NullPointerException。它编译得很好。但是当我运行它时出现此错误。
因此,我更改了工作区并加载了项目的先前工作版本,我将其保存为备份。还有同样的问题。该应用程序在加载第一个布局之前就崩溃了......

这是我的日志:

06-28 20:04:46.428: D/AndroidRuntime(382): Shutting down VM
06-28 20:04:46.428: W/dalvikvm(382): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-28 20:04:46.542: E/AndroidRuntime(382): FATAL EXCEPTION: main
06-28 20:04:46.542: E/AndroidRuntime(382): java.lang.RuntimeException: Unable to start activity ComponentInfo{cloud.mobile/cloud.mobile.MCActivity}: java.lang.NullPointerException
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.os.Looper.loop(Looper.java:123)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-28 20:04:46.542: E/AndroidRuntime(382):  at java.lang.reflect.Method.invokeNative(Native Method)
06-28 20:04:46.542: E/AndroidRuntime(382):  at java.lang.reflect.Method.invoke(Method.java:521)
06-28 20:04:46.542: E/AndroidRuntime(382):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-28 20:04:46.542: E/AndroidRuntime(382):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-28 20:04:46.542: E/AndroidRuntime(382):  at dalvik.system.NativeStart.main(Native Method)
06-28 20:04:46.542: E/AndroidRuntime(382): Caused by: java.lang.NullPointerException
06-28 20:04:46.542: E/AndroidRuntime(382):  at cloud.mobile.MCActivity.setLoggedIn(MCActivity.java:279)
06-28 20:04:46.542: E/AndroidRuntime(382):  at cloud.mobile.MCActivity.onCreate(MCActivity.java:198)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-28 20:04:46.542: E/AndroidRuntime(382):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
06-28 20:04:46.542: E/AndroidRuntime(382):  ... 11 more

PS-今天,早些时候我玩过一些字符串数组并动态存储在其中。这是我第一次收到这个错误..

4

1 回答 1

4

没有代码,很难说出发生了什么,但开始的一点是

 at cloud.mobile.MCActivity.setLoggedIn(MCActivity.java:279

检查 MCActivity 中的第 279 行。在该特定行上,您尝试对“某个空值”进行操作

于 2012-06-28T14:50:12.957 回答