当我的应用程序被杀死后重启(大约一个小时之后被Android或者我通过任务杀手杀死它),应用程序崩溃并显示以下消息:
10-23 09:07:41.120:ERROR / AndroidRuntime(647):致命异常:主要 10-23 09:07:41.120:ERROR / AndroidRuntime(647):java.lang.RuntimeException:无法启动活动ComponentInfo {com.test.testapp /com.test.testapp.TestingActivity}:java.lang.NullPointerException 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.os.Handler.dispatchMessage(Handler.java:99) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.os.Looper.loop(Looper.java:123) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.app.ActivityThread.main(ActivityThread.java:4627) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):at java.lang.reflect.Method.invokeNative(Native Method) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):at java.lang.reflect.Method.invoke(Method.java:521) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):at dalvik.system.NativeStart.main(Native Method) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):引起:java.lang.NullPointerException 10-23 09:07:41.120:ERROR / AndroidRuntime(647):at com.test.testapp.TestingActivity.onCreate(TestingActivity.java:178) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 10-23 09:07:41.120:ERROR / AndroidRuntime(647):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
我在该活动中有一个计时器,我想也许它与该线程有关,但即使我删除计时器它仍然崩溃。我真的无法弄清楚这里有什么问题。有什么想法吗?
提前致谢
答案 0 :(得分:0)
Android将回收内存。你需要检查它不是空的。它说哪条线也在抱怨