<1>Android Studio Tip of the Day: Toggle Breakpoints

Android Studio Tip of the Day--BreakpointsThe next few tips will be about debugging. So let's start with the most basic one: adding a good old line breakpoint!

I am pretty sure that by now you have debugged an app and know how to toggle it by left-clicking in the left gutter.
Here is the correct shortcut to toggle it without your mouse.
Shortcut: 
 - Mac: Cmd+F8
 - Windows/Linux: Ctrl+F8

Android Studio Tip of the Day--Breakpoints

View all breakpoints

Shortcut:

-Mac:Shift + Cmd +F8


<2>Android Studio Tip of the Day: Disable Breakpoints

This will disable the breakpoint. Particularly useful when you have some complicated conditional or logging breakpoint that you don't need right now but don't want to recreate next time.
Shortcut: 
  - Mouse: Alt+LeftClick on an existing breakpoint in the left gutter
  - There is no keyboard shortcut but you can create one if you use it often enough.

Android Studio Tip of the Day--Breakpoints


<3>Android Studio Tip of the Day: Temporary Breakpoints

This is a way to add a breakpoint that will be removed automatically the first time you hit it.
Shortcut: 
  - Mouse: Alt+LeftClick in the left gutter
  - Mac: Cmd+Alt+Shift+F8
  - Windows/Linux: Ctrl+Alt+Shift+F8

Android Studio Tip of the Day--Breakpoints



<4>Android Studio Tip of the Day: Conditional Breakpoints
In a nutshell, only do break when a certain condition is met. You can enter any java expression that returns a boolean based on the current scope. 
And do enjoy the fact that the condition textbox supports code completion!
Shortcut: 
  - Right click on a breakpoint and enter a condition.

Android Studio Tip of the Day--Breakpoints


<5>Android Studio Tip of the Day: Logging Breakpoints

This is a breakpoint that logs stuff instead of breaking.
This can be useful when you want to log some stuff right now but cannot or don't want to redeploy with logging code added.
Shortcut: 
  - Right click on a breakpoint, uncheckSuspend and type your message in "Log evaluated Expression"

Android Studio Tip of the Day--Breakpoints



From:https://plus.google.com/collection/wtO0PB



相关文章:

  • 2021-04-03
  • 2022-01-28
  • 2021-09-28
  • 2021-12-12
  • 2022-01-29
  • 2022-12-23
  • 2022-01-22
  • 2022-01-25
猜你喜欢
  • 2021-07-05
  • 2021-09-14
  • 2021-06-08
  • 2021-07-04
  • 2021-08-18
  • 2021-09-04
  • 2021-11-30
相关资源
相似解决方案