gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 16:05:05 25 4
gpt4 key购买 nike

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



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


我无法点击任何地方。

最佳答案

您只能双击 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) 行将在代码中显示该行。

关于android - LogCat 中的双击错误行不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19620936/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com