我试过运行我的应用程序,但收到一条消息“不幸的是应用程序停止了”。我是Android开发的新手,我不明白一些错误。谢谢。提前 我的logcat如下:
02-03 10:48:05.750: D/dalvikvm(881): Not late-enabling CheckJNI (already on)
02-03 10:48:08.940: D/dalvikvm(881): GC_FOR_ALLOC freed 42K, 4% free 2982K/3088K, paused 143ms, total 144ms
02-03 10:48:08.940: I/dalvikvm-heap(881): Grow heap (frag case) to 3.450MB for 500416-byte allocation
02-03 10:48:09.160: D/dalvikvm(881): GC_CONCURRENT freed 3K, 4% free 3467K/3580K, paused 3ms+3ms, total 206ms
02-03 10:48:09.160: D/dalvikvm(881): WAIT_FOR_CONCURRENT_GC blocked 187ms
02-03 10:48:09.990: D/AndroidRuntime(881): Shutting down VM
02-03 10:48:09.990: W/dalvikvm(881): threadid=1: thread exiting with uncaught exception (group=0xb3b08ba8)
02-03 10:48:10.010: E/AndroidRuntime(881): FATAL EXCEPTION: main
02-03 10:48:10.010: E/AndroidRuntime(881): Process: com.example.judoapp, PID: 881
02-03 10:48:10.010: E/AndroidRuntime(881): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.judoapp/com.example.judoapp.MainActivity}: java.lang.NullPointerException
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.ActivityThread.access$800(ActivityThread.java:135)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.os.Handler.dispatchMessage(Handler.java:102)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.os.Looper.loop(Looper.java:136)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.ActivityThread.main(ActivityThread.java:5017)
02-03 10:48:10.010: E/AndroidRuntime(881): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 10:48:10.010: E/AndroidRuntime(881): at java.lang.reflect.Method.invoke(Method.java:515)
02-03 10:48:10.010: E/AndroidRuntime(881): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
02-03 10:48:10.010: E/AndroidRuntime(881): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-03 10:48:10.010: E/AndroidRuntime(881): at dalvik.system.NativeStart.main(Native Method)
02-03 10:48:10.010: E/AndroidRuntime(881): Caused by: java.lang.NullPointerException
02-03 10:48:10.010: E/AndroidRuntime(881): at com.example.judoapp.MainActivity.onCreate(MainActivity.java:83)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.Activity.performCreate(Activity.java:5231)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-03 10:48:10.010: E/AndroidRuntime(881): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
02-03 10:48:10.010: E/AndroidRuntime(881): ... 11 more
02-03 10:48:18.740: I/Process(881): Sending signal. PID: 881 SIG: 9
02-03 10:48:20.350: D/dalvikvm(911): GC_FOR_ALLOC freed 48K, 4% free 2983K/3096K, paused 91ms, total 93ms
02-03 10:48:20.360: I/dalvikvm-heap(911): Grow heap (frag case) to 3.450MB for 500416-byte allocation
02-03 10:48:20.560: D/dalvikvm(911): GC_FOR_ALLOC freed 3K, 4% free 3468K/3588K, paused 186ms, total 186ms
02-03 10:48:20.990: D/AndroidRuntime(911): Shutting down VM
02-03 10:48:20.990: W/dalvikvm(911): threadid=1: thread exiting with uncaught exception (group=0xb3b08ba8)
答案 0 :(得分:2)
这是一个空指针异常,它意味着您正在尝试访问变量,布局元素或尚未初始化的内容。 这发生在MainActivity.java的第83行,如果您发布我们可以帮助的代码..