Android Studio Tip of the Day--Breakpoints

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

The 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


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.



<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




<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.



<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"




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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值