Android应用程序停止工作,找到错误

时间:2014-08-05 14:46:47

标签: android

早些时候我的应用程序工作正常,但经过一些编辑后它停止了工作。以下是当我的应用程序停止工作时的logcat。请帮忙:

    08-05 14:39:10.071: E/AndroidRuntime(767): FATAL EXCEPTION: main
    08-05 14:39:10.071: E/AndroidRuntime(767): java.lang.RuntimeException: Unable to       start activity ComponentInfo{com.example.hi_5physics/com.example.hi_5physics.MainActivity}: java.lang.NullPointerException
    08-05 14:39:10.071: E/AndroidRuntime(767):  at   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.os.Handler.dispatchMessage(Handler.java:99)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.os.Looper.loop(Looper.java:137)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.app.ActivityThread.main(ActivityThread.java:5039)
   08-05 14:39:10.071: E/AndroidRuntime(767):   at java.lang.reflect.Method.invokeNative(Native Method)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at java.lang.reflect.Method.invoke(Method.java:511)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at dalvik.system.NativeStart.main(Native Method)
    08-05 14:39:10.071: E/AndroidRuntime(767): Caused by: java.lang.NullPointerException
    08-05 14:39:10.071: E/AndroidRuntime(767):  at com.example.hi_5physics.MainActivity.onCreate(MainActivity.java:48)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.app.Activity.performCreate(Activity.java:5104)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
    08-05 14:39:10.071: E/AndroidRuntime(767):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
    08-05 14:39:10.071: E/AndroidRuntime(767):  ... 11 more
    08-05 14:39:16.201: I/Process(767): Sending signal. PID: 767 SIG: 9

1 个答案:

答案 0 :(得分:0)

08-05 14:39:10.071: E/AndroidRuntime(767): Caused by: java.lang.NullPointerException
08-05 14:39:10.071: E/AndroidRuntime(767): at com.example.hi_5physics.MainActivity.onCreate(MainActivity.java:48)

检查您的活动的onCreate方法,NullPointerException