如何调试Android项目 [英] How to debug Android project

查看:196
本文介绍了如何调试Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的Andr​​oid框架(使用Eclipse),我有一个关于调试的问题。最近我做了这个错误在一个活动:

I'm new to the Android framework (using Eclipse) and I have a question about debugging. Recently I did this error in an activity:

// The installation button
Button button = (Button) findViewById(R.id.preparationInstallButtonID);
button.setOnClickListener(this);

setContentView(R.layout.preparation);

即。我试过之前的布局已经变得添加一个onclick事件。这崩溃的程序,对不起,应用XXX意外停止。再次运行,具有调试模式,Eclipse将打开一个包含调试窗口。线程3;>(暂停)等(我敢肯定,你知道我说的是哪个窗口)

i.e. I tried to add an onclick-event prior the layout had been rendered. This crashed the program, "Sorry, the application xxx has stopped unexpectedly". Running it again, with debug-mode, Eclipse opens a Debug-window containing "Thread<3> (Suspended)" etc (I'm sure you know which window I'm talking about).

现在,我怎么能在这里提取出有用的数据?关于上述问题,我发现了如何通过反复试验的示数来修复它,但让我们说我不能做试验和错误,调试窗口如何能帮助我找到错误的根源?它说:例外的RuntimeException,但我没有看到任何指针作为凡在我code出现异常的。

Now, how am I able to extract useful data here? Regarding the problem above I found how to fix it by trial-and-erroring, but let's say I'm not able to do trial-and-error, how can the debug-window help me find the source of the error? It says "exception RuntimeException", but I don't see any pointers as of where in my code the exception occured.

推荐答案

使用的LogCat中这会给错误消息和你一切,在你为TestDevice /仿真器不胜枚举。

Use the LogCat this will give you the error messages and everything else that goes on in your testdevice/emulator.

窗口 - >显示视图 - >其他 - > LogCat中

Window -> Show View -> Other -> LogCat

这篇关于如何调试Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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