简体   繁体   English

如何在 Android Studio 中调试?

[英]How to Debug in Android Studio?

How can I我怎样才能

  1. Set a breakpoint.设置断点。
  2. Stop on Breakpoint.在断点处停止。
  3. Release, but leave in debug mode.释放,但保持调试模式。 By release, I mean don't step to next line.通过释放,我的意思是不要跳到下一行。 Jump to next breakpoint.跳转到下一个断点。 Or just wait until a breakpoint is hit或者只是等到断点被击中

I have no time or desire to go diving into the SDK classes.我没有时间也不想深入研究 SDK 类。 I just want out after I have stepped through a few lines.我只是想在我跨过几行之后离开。 So far the only thing I have been able to do is just killing the debug session.到目前为止,我唯一能做的就是终止调试会话。 Where is the "RELEASE" button to just move on?继续前进的“释放”按钮在哪里?

I mean to me this is just obvious.我的意思是对我来说这很明显。 You don't want to step deeper and deeper into the code.您不想越来越深入地了解代码。 Once your done looking just resume into debug mode.完成查找后,只需恢复到调试模式即可。 Wait until you hit another break point.等到你遇到另一个断点。 How do I do this?我该怎么做呢? Can it be done?可以做到吗? And why is there no button for this?为什么没有这个按钮?

Just resume, stay in debug mode.继续,保持调试模式。 How do you do this?你怎么做到这一点?

The top left button in the debug window (the green triangle) is doing what you want.调试窗口左上角的按钮(绿色三角形)正在执行您想要的操作。 "Resume Program (F9)" “恢复程序(F9)”

Breakpoints are toggled by clicking in the narrow column to the left of the code.通过单击代码左侧的窄列来切换断点。 You can also have conditional breakpoints, for example by right clicking the red spot I could enter someVariable > someOtherVariable .您还可以设置条件断点,例如通过右键单击红点,我可以输入someVariable > someOtherVariable Other options include suspending the whole app, or just the thread that encountered the breakpoint.其他选项包括挂起整个应用程序,或仅挂起遇到断点的线程。 在此处输入图片说明

Buttons going down the left向左下降的按钮

  • Resume恢复
  • Pause暂停
  • Stop停止
  • View breakpoints查看断点
  • Mute breakpoints静音断点

Buttons across the top顶部的按钮

  • Show execution point显示执行点
  • Step over跨过去
  • Step into踏入
  • Force step into强行进入
  • Step out走出去

调试器

您应该执行以下操作以启用调试器选项 - https://developer.android.com/studio/debug

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM