使用 Android 调试器 - 这是解释潜在错误的正确方法吗?
今天我正在阅读有关调试的内容,我在 stackoverflow 上看到一篇文章说 eclipse 中的调试器本身并没有提供很多有用的信息,并且大多数信息都位于 LogCat 中?
我已经完成了 LogCat 输出的屏幕截图,看到了令人眼花缭乱的彩色输出。我继续使用最明显的危险颜色(红色),并在输出的末尾看到它显示由 fillData() 和 onCreate() 中的 NullpointerException 引起的错误。
我的问题是:
这是否表明我的代码中存在错误(因为我的代码在启动时崩溃)?该错误是 NullpointerException 吗?这是找出代码中即时错误的正确方法吗?
Logcat 的红色输出是放大查找 bug 问题的主要部分吗?
谢谢 !我认为这篇文章对许多菜鸟 Android 编码员来说很有用,因为没有太多资源教导如何正确使用调试器:(
Today I was reading up on debugging and I came across a post in stackoverflow saying that the debugger itself in eclipse does not tell alot of useful information and most information lies in the LogCat ?
I've done a screenshot of the LogCat output and saw a colorful output which is dazzling. I went ahead with the most obvious danger color (red) and saw that at the end of the output it says error caused by NullpointerException in fillData() and onCreate().
My question is:
Is that an indication of the bug in my code (as mine crashes at startup) ? Is the bug Nullpointerexception ? Is this the right way of finding out immediate bugs in code ?
Is the red color output of Logcat the main portion to zoom in to look for bug problems?
Thank you ! I think this post wud be useful for many noob android coders as there isn't many resources out there teaching how to use the debugger properly :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要查看所有应用程序日志,您应该检查“DDMS”中的“LogCat”。
在 LogCat 中,您可以按日志级别(V=详细、D=调试、I=信息、W=警告和 E=错误)过滤日志。
您可以通过按错误过滤来检查应用程序崩溃 - 这样您就可以检查问题发生的位置(通过查看堆栈跟踪)。
但是,如果您想执行逐步调试,请添加断点并在调试模式下运行应用程序。然后打开透视图“调试”,您将能够逐行调试。
To view all application logs you should check "LogCat" in "DDMS".
In LogCat you can filter logs by Log Level (V=Verbose, D=Debug, I=Info, W=Warning and E=Error).
You can check application crashes by filtering by Error - this way you can check where the problem is happening (by viewing the stacktrace).
However, if you want to perform step by step debug, add breakpoints and run the application in debug mode. Then open perspective "Debug" and you'll be able to debug line by line.