在Android上的Eclipse调试有什么问题? [英] What's wrong with debugging in Eclipse on Android?

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

问题描述


可能重复:

似乎是Android的无用的调试环境

显然,Visual Studio被宠坏了,因为虽然我正在学习Android和Eclipse环境,但在Eclipse中调试应用程序正在成为进一步开发中的严重缺陷。

I've obviously been spoiled by Visual Studio, because although I'm just learning Android and the Eclipse environment, debugging apps in Eclipse is becoming a serious detriment to further development.

例如,Eclipse将会将这个除数编译为零:

For example, Eclipse will compile this divide by zero just fine:

public class Lesson2Main extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate (savedInstanceState);

        int i = 1 / 0;

        TextView tv = new TextView (this);
        tv.setText ("Hello, Android!");
        setContentView (tv);
    }
}

然后,当它在调试器下执行它时,我将获得一个无用的调试信息的全屏,其中没有实际上指向包含错误的特定行。

And then, when it executes it under the debugger, I will get a full screen of useless debug info, non of which actually points me to the specific line containing the error.

stackTrace在异常('e ')信息树,它只是陈述一个消息,指出'ArithmeticException'。 (这很好,你怎么指向我找到它的方向!)

The stackTrace is null within the exception ('e') info tree, and it simply states a message stating 'ArithmeticException'. (that's nice, how about you point me in the direction of where you found it!?)

我已经看了整个屏幕,令人困惑的是,这个IDE可以不要这样做使用Eclipse度假村开发的每个人都会回到1991年,其中printf()像每隔一段时间的记录一样,以追踪错误?

I've looked all over the screen and am baffled that this IDE can't get this right. Does developing with Eclipse resort everyone back to 1991 with printf() like logging at every interval then to track down bugs? Seriously.

有没有一个配置或插件,我没有提供帮助?

Is there a configuration or plug-in that I'm missing to help with this?

我没有用XCode测试这种情况,但是如果iPhone开发者。 IDE处理这个更像是Visual Studio,那么难怪Android市场有这么少的应用程序。

I haven't tested this case with XCode, but if the iPhone dev. IDE handles this more like Visual Studio, then no wonder the Android marketplace has so few apps.

我对Android感到兴奋,但似乎Eclipse正在进入

I'm excited about Android, but it seems that Eclipse is getting in the way.

推荐答案

是的,你错过了一个称为LogCat的Eclipse非常重要的插件之一。它捕获您的Android程序提供的所有调试日志,无论是在仿真器上运行还是在真正的手机上运行。后者显然需要将手机插入计算机,而不太明显地,启用应用程序 - >开发 - >启用USB调试的设置。

Yes, you've missed one of the very important plug-ins for Eclipse called "LogCat". It catches all the debugging logs that your Android program gives, whether it's running on the Emulator or a real phone. The latter obviously requires that the phone be plugged in to the computer, and less-obviously, the setting in Application -> Development -> Enable USB Debugging be enabled.

LogCat消息可以让您全面了解导致错误的原因,包括行号。要在Eclipse中打开LogCat,请转到窗口 - >显示视图 - >其他 - > Android(列表中的其中一个文件夹) - > LogCat。然后将LogCat窗口停放在您可以轻松查看的地方,Eclipse会记住该位置,并在下次开始时再次打开它。

The LogCat messages give you the full breakdown of what caused the error, including the line number. To open LogCat in Eclipse, go to Window -> Show View -> Other -> Android (one of the folders in the list) -> LogCat. Then dock the LogCat window somewhere where you can see it easily, and Eclipse will remember that location and open it up again next time your start it.

(有时候LogCat和模拟器彼此断开连接,简单的方法就是关闭Eclipse和仿真器,然后重新启动它们。)

(Sometimes LogCat and the Emulator get disconnected from each other. The simple way to fix that is just to close Eclipse and the emulator, then restart them both.)

这篇关于在Android上的Eclipse调试有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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