应用程序更改后应用程序崩溃

时间:2013-03-20 15:46:27

标签: android

我的应用程序运行正常,直到今天我做了一些更改,并且我被迫关闭。

这是logcat

     03-20 21:11:05.441: D/dalvikvm(515): GC_EXTERNAL_ALLOC freed 95K, 51% free 2680K/5379K, external 2037K/2137K, paused 75ms
03-20 21:11:06.070: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.080: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
   03-20 21:11:06.080: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because      it      is not complex!
03-20 21:11:06.080: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.080: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.110: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.110: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.110: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.121: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.121: W/ResourceType(515): Skipping entry 0x7f02000f in package table 0 because it is not complex!
03-20 21:11:06.170: D/AndroidRuntime(515): Shutting down VM
03-20 21:11:06.170: W/dalvikvm(515): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-20 21:11:06.190: E/AndroidRuntime(515): FATAL EXCEPTION: main
03-20 21:11:06.190: E/AndroidRuntime(515): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.indianic.demo.calendark/com.indianic.demo.calendark.Abc}: java.lang.NullPointerException
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.os.Looper.loop(Looper.java:123)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.app.ActivityThread.main(ActivityThread.java:3683)
03-20 21:11:06.190: E/AndroidRuntime(515):  at java.lang.reflect.Method.invokeNative(Native Method)
03-20 21:11:06.190: E/AndroidRuntime(515):  at java.lang.reflect.Method.invoke(Method.java:507)
03-20 21:11:06.190: E/AndroidRuntime(515):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-20 21:11:06.190: E/AndroidRuntime(515):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-20 21:11:06.190: E/AndroidRuntime(515):  at dalvik.system.NativeStart.main(Native Method)
03-20 21:11:06.190: E/AndroidRuntime(515): Caused by: java.lang.NullPointerException
03-20 21:11:06.190: E/AndroidRuntime(515):  at com.indianic.demo.calendark.Abc.onCreate(Abc.java:221)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-20 21:11:06.190: E/AndroidRuntime(515):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-20 21:11:06.190: E/AndroidRuntime(515):  ... 11 more
03-20 21:11:08.470: I/Process(515): Sending signal. PID: 515 SIG: 9

这是java代码http://www.mediafire.com/view/?ud3lizq4kduz1dc
我无法在此处上传代码

谢谢@codeMagic,问题是按钮5评论:)

1 个答案:

答案 0 :(得分:2)

您已button5注释掉第72行

的初始化
  //button5 = (Button) findViewById(R.id.button5);

取消注释该行,而button将不会是null

当你看到你的logcat时,你会看到

Caused by: java.lang.NullPointerException

查找引用您的文件的第一行(恰好是

at com.indianic.demo.calendark.Abc.onCreate(Abc.java:221)

这告诉您null第221行的内容为ABC.java。您可以随时查看此处并尝试找出null的内容和原因,这将使您的调试更快。希望这有帮助