LogCat中的双击错误行不起作用

时间:2013-10-27 17:15:47

标签: android error-handling logcat

我正在为Eclipce编写一个android程序 我遇到了错误调试的问题,当发生错误时,例如 NullPointerExceptioin 我可以看到,log 双击(在日志上)无法正常工作?据我所知,它应该向我显示代码中出现异常的行。 有人知道如何解决这个问题吗?



10-27 20:28:41.202: E/AndroidRuntime(3232): FATAL EXCEPTION: main
10-27 20:28:41.202: E/AndroidRuntime(3232): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bignerdranch.andriod.geoquiz/com.bignerdranch.andriod.geoquiz.QuizActivity}: java.lang.NullPointerException
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.os.Looper.loop(Looper.java:137)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.ActivityThread.main(ActivityThread.java:5039)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at java.lang.reflect.Method.invokeNative(Native Method)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at java.lang.reflect.Method.invoke(Method.java:511)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at dalvik.system.NativeStart.main(Native Method)
10-27 20:28:41.202: E/AndroidRuntime(3232): Caused by: java.lang.NullPointerException
10-27 20:28:41.202: E/AndroidRuntime(3232):     at com.bignerdranch.andriod.geoquiz.QuizActivity.onCreate(QuizActivity.java:57)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.Activity.performCreate(Activity.java:5104)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
10-27 20:28:41.202: E/AndroidRuntime(3232):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
10-27 20:28:41.202: E/AndroidRuntime(3232):     ... 11 more


我无法点击任何地方。

1 个答案:

答案 0 :(得分:4)

您只能双击logcat中提及包名称的行。您无法双击LogCat中的所有行

例如,对于此LogCat

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.exampl.sample5/com.exampl.sample5.MainActivity}: java.lang.NullPointerException
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.os.Looper.loop(Looper.java:123)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.app.ActivityThread.main(ActivityThread.java:3683)
10-27 23:06:22.269: E/AndroidRuntime(348):  at java.lang.reflect.Method.invokeNative(Native Method)
10-27 23:06:22.269: E/AndroidRuntime(348):  at java.lang.reflect.Method.invoke(Method.java:507)
10-27 23:06:22.269: E/AndroidRuntime(348):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-27 23:06:22.269: E/AndroidRuntime(348):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-27 23:06:22.269: E/AndroidRuntime(348):  at dalvik.system.NativeStart.main(Native Method)
10-27 23:06:22.269: E/AndroidRuntime(348): Caused by: java.lang.NullPointerException
10-27 23:06:22.269: E/AndroidRuntime(348):  at com.example.sample.MainActivity.onCreate(MainActivity.java:19)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-27 23:06:22.269: E/AndroidRuntime(348):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-27 23:06:22.269: E/AndroidRuntime(348):  ... 11 more

由于com.example.sample是我的包名,因此双击第com.example.sample.MainActivity.onCreate(MainActivity.java:19)行将在代码中显示该行。