在Eclipse的Andr​​oid应用程序在调试的时候无法看到匿名类里面最后一个变量的内容变量、应用程序、里面、时候

2023-09-06 02:05:28 作者:初歌

当在调试(日食),我看不到,也没有在防爆pressions查看变量中的变数内容查看,也没有在显示图像 - 如果变量是一个匿名类外定义,但调试是内部的匿名类。

When in debug (eclipse), I cannot see variables content in the variables view, nor in Expressions view, nor in Display view - if the variables are defined outside an anonymous class but the debug is inside the anonymous class.

当我尝试看看在调试的内容,我得到的错误: x不能被解析到一个变量

When I try to see the content in debug, I get the error: x cannot be resolved to a variable.

在下面的例子中,x不能得到解决:

In the following example, x cannot be resolved:

private void someMethod(final Object x) {
  new Runnable() {
    public void run() {
      Log.i(x); // x is printed correctly but cannot be resolved when in Debug
    }
  }.run();
}

这个问题关于Eclipse开发环境 - 关于调试机器人。 这不是最后的讨论,也没有编译 - 只需调试

This question regards the eclipse development environment - regarding debugging Android. It's not a discussion about final, nor compilation - just debugging.

推荐答案

我也遇到了类似的问题,同时调试使用线程的应用程序。我猜你的应用程序是多线程的,因为我只用在这种情况下要面对这样的事情。 这可能是因为当你运行直接大多都是你的线程将在同一时间启动该程序。不过,虽然在调试模式下你的线程有断点集合中的一个将举行,其中为沿启动其它线程将被已完成或其他方式。 这就是原因,人说调试多线程应用程序是有点困难,除非你保持优先级或进行线程同步。

I have faced similar issues while debugging applications that uses threads. I guess your application is multi-threaded one, because I used to face things like this only at that situation. This could be because when you run the program directly mostly all your threads will be started at the same time. But while in debug mode one of your thread which has the breakpoint set will be holding, where as other threads which started along would have been completed already or the other way around. That's the reason people say debugging a multi threaded application is bit more difficult unless you maintain the priority or make threads synchronized.

希望这个信息帮助。而不是停止与一个破发点的流量因此,试图打印的价值,你需要使用系统输出或类似的事情,这就好比刚刚运行的程序,但还在调试知道的价值,自己的路:)

Hope this info helps. So instead of stopping the flow with a break point, try to print the value where you need to know the value using sysout or things like that, which is like just running the program but still debugging, your own way:)

 
精彩推荐