如何在调试中使用 Eclipse 交互式控制台

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5579436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:07:36  来源:igfitidea点击:

How to use Eclipse interactive console in debug

androideclipsedebugging

提问by Cris

I'm trying to play with debug in Android app and, when a breakpoint is encountered, Eclipse shows me a lot of windows, one of which is the "Interactive Console" with a prompt: I think to be able to enter statements and/or other stuff, but it seems to be disabled. How can I work with it?

我正在尝试在 Android 应用程序中进行调试,当遇到断点时,Eclipse 会向我显示很多窗口,其中一个是带有提示的“交互式控制台”:我认为能够输入语句和/或其他东西,但它似乎被禁用。我该如何使用它?

回答by ddewaele

Window - Show View - Debug - Display

窗口 - 显示视图 - 调试 - 显示

That will provide you with a window to enter statements and execute/inspect them. This is a feature that's available in core eclipse platform. It works in most cases for Android based projects as well.

这将为您提供一个窗口来输入语句并执行/检查它们。这是核心 eclipse 平台中可用的功能。它在大多数情况下也适用于基于 Android 的项目。

More info on the display view can be found here : http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/views/debug/ref-debug_view.htm

可以在此处找到有关显示视图的更多信息:http: //help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/views/debug/ref-debug_view。 htm

For a nice overview of the debugging features of Eclipse, check out this post : http://www.cavdar.net/2008/09/13/5-tips-for-debugging-java-code-in-eclipse/

要全面了解 Eclipse 的调试功能,请查看这篇文章:http: //www.cavdar.net/2008/09/13/5-tips-for-debugging-java-code-in-eclipse/

回答by Jonathan Heinen

The "Interactive Console" within the Debug View of Eclipse is used whenever the debugged program expects some input from the console.

Eclipse 调试视图中的“交互式控制台”在被调试程序需要来自控制台的一些输入时使用。

回答by Arun Chandravanshi

  1. You can use Logcatfor and can see your check points using

    android.util.Log.e("","CheckPoint");

  2. You can toast your check points using Toastlike:

    Toast.makeText(this, "Write here what you want see",1 or 0).show();

    1-> long time displaying and 0 for short time.

    This toast display in your device screen when programe running.

  3. You can use console screen for seeing output like print statements Ex---

    java.lang.System.out.print("Checking");

  1. 您可以使用Logcatfor 并且可以使用查看您的检查点

    android.util.Log.e("","CheckPoint");

  2. 您可以使用以下方法为您的检查点敬酒Toast

    Toast.makeText(this, "Write here what you want see",1 or 0).show();

    1-> 长时间显示,0 表示短时间。

    程序运行时,此吐司会显示在您的设备屏幕上。

  3. 您可以使用控制台屏幕查看打印语句之类的输出 Ex---

    java.lang.System.out.print("Checking");

回答by Brian Henry

It's possibleyou have other plugins installed that provide that view, and it's not meant to be used by Android Java code. See here(not accepted answer, but community-favored one).

可能安装了其他提供该视图的插件,但并不打算供 Android Java 代码使用。请参阅此处(未接受的答案,而是社区支持的答案)。

回答by Arun

use try{ statements...; } catch(Exception e){ System.out.println("the error message "+e); }will show the error messages.

使用 try{ statements...; } catch(Exception e){ System.out.println("the error message "+e); }将显示错误消息。