如何在调试时输出值

时间:2022-02-11 00:15:18

In Xcode I am able to "po" any values while debugging. Is there a way to do this in Android Studio?

在Xcode中,我可以在调试时“po”任何值。在Android Studio中有这样的方法吗?

For example, if I hit a breakpoint and want to print out certain values in realtime as opposed to having to use Logs in my code?

例如,如果我命中一个断点,并希望在实时打印某些值,而不是在代码中使用日志?

3 个解决方案

#1


4  

Use Watches. It gives you the ability to evaluate expressions.

使用手表。它给你评估表达式的能力。

#2


4  

When you hit debug point, there are two ways to check values :

当您到达调试点时,有两种检查值的方法:

(1) Add Watch for any variable

(1)增加对任何变量的观察

如何在调试时输出值

(2) Hover over any variable, the value will be displayed there

(2)将鼠标悬停在任何变量上,值就会显示在那里

#3


0  

Set BreakPoint in the line you want to evaluate then when you reach to BreakPoint

在你想要评估的直线上设置断点,然后到达断点。

press Alt+F8

按Alt + F8

Then type your value to evaluate and you can see result :)

然后输入您的值进行评估,您可以看到结果:)


#1


4  

Use Watches. It gives you the ability to evaluate expressions.

使用手表。它给你评估表达式的能力。

#2


4  

When you hit debug point, there are two ways to check values :

当您到达调试点时,有两种检查值的方法:

(1) Add Watch for any variable

(1)增加对任何变量的观察

如何在调试时输出值

(2) Hover over any variable, the value will be displayed there

(2)将鼠标悬停在任何变量上,值就会显示在那里

#3


0  

Set BreakPoint in the line you want to evaluate then when you reach to BreakPoint

在你想要评估的直线上设置断点,然后到达断点。

press Alt+F8

按Alt + F8

Then type your value to evaluate and you can see result :)

然后输入您的值进行评估,您可以看到结果:)