应用程序意外停止:如何调试? [英] The application has stopped unexpectedly: How to Debug?

查看:32
本文介绍了应用程序意外停止:如何调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意,与主题标题为应用程序已意外停止"的许多其他问题不同,我并不是要求对特定问题进行故障排除.

Please note, unlike many other questions having the subject title "application has stopped unexpectedly", I am not asking for troubleshooting a particular problem.

相反,我希望为 Android/Eclipse/Java 新手提供一个最佳策略大纲,以解决消化大量信息以开发(和调试!)一个简单的 Android 应用程序的艰巨任务.

Rather, I am asking for an outline of the best strategy for an Android/Eclipse/Java rookie to tackle this formidable task of digesting huge amounts of information in order to develop (and debug!) a simple Android application.

就我而言,我从 SDK 中获取了示例骨架应用程序,稍微对其进行了修改,我在尝试运行它的那一刻得到了什么?

In my case, I took the sample skeleton app from the SDK, modified it slightly and what did I get the moment I try to run it?

应用程序(process.com.example.android.skeletonapp)意外停止了.请试试再次.

The application (process.com.example.android.skeletonapp) has stopped unexpectedly. Please try again.

好的,所以我知道我必须查看 LogCat.它充满了带时间戳的线条盯着我……我现在该怎么办?我需要寻找什么?

OK, so I know that I have to look LogCat. It's full of timestamped lines staring at me... What do I do now? What do I need to look for?

有没有办法单步执行程序,找到导致应用程序崩溃的语句?(我以为 Java 程序永远不会崩溃,但显然我错了)

Is there a way to single-step the program, to find the statement that makes the app crash? (I thought Java programs never crash, but apparently I was mistaken)

如何放置断点?

除了教程吗?>这个?

Can you recommend an Android debug tutorial online, other than this one?

推荐答案

我也是 Eclipse/Android 初学者,但希望我的简单调试过程可以帮助...

I'm an Eclipse/Android beginner as well, but hopefully my simple debugging process can help...

您可以在 Eclipse 中设置断点,方法是右键单击要中断的行旁边并选择Toggle Breakpoint".从那里您将要选择调试"而不是标准的运行",这将允许您逐步完成等等.使用 LogCat 提供的过滤器(在您的教程中引用),这样您就可以定位您想要的消息,而不是费力地浏览所有输出.这将(希望)在帮助您理解错误方面大有帮助.

You set breakpoints in Eclipse by right-clicking next to the line you want to break at and selecting "Toggle Breakpoint". From there you'll want to select "Debug" rather than the standard "Run", which will allow you to step through and so on. Use the filters provided by LogCat (referenced in your tutorial) so you can target the messages you want rather than wading through all the output. That will (hopefully) go a long way in helping you make sense of your errors.

至于其他好的教程,我自己也在四处寻找,但还没有找到任何宝石.

As for other good tutorials, I was searching around for a few myself, but didn't manage to find any gems yet.

这篇关于应用程序意外停止:如何调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆