我已经在这个项目上工作了几个星期,突然之间我得到了这个java.lang.NullPointerException
。它的编译很好。但是当我运行它时,我收到了这个错误
所以我更改了工作区并加载了我项目的先前工作版本,我将其保留为备份。并且存在同样的问题。在加载第一个布局之前,应用程序崩溃了......
这是我的logcat:
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
P.S-今天,早些时候我玩了一些String Arrays并动态存储在其中。那是我第一次收到这个错误..
答案 0 :(得分:4)
如果没有代码,很难说出发生了什么,但要点开始就是
at cloud.mobile.MCActivity.setLoggedIn(MCActivity.java:279
检查MCActivity中的第279行。在那个特定的行,你试图操作“一些空值”