How to enable non-suspending logging breakpoints (APG-4)
Rajesh Hadiya
Helps you to master Android & Spring Boot ?? Aaye hain to thoda content dekh ke jaiye ?? Join our next Android meetup (pinned post ??)
While debugging android apps, you often use log statements to trace a specific point.
These logs are normally not required in release versions, so you would need to manually delete them. It takes a lot of labor.
Android studio provides a fantastic feature to add and remove log statements using breakpoints.
To use it,
1. Place any breakpoint on a line by clicking on the gutter column (or use Ctrl + F8) and then right-click.
2. A pop-up menu will appear. Uncheck the suspend option and another expanded menu will appear.
3. Select the Evaluate and log option, then type a logging statement (you can also include variables)
Now, when you run the app in debug mode, your code will hit the breakpoint?but it won't halt execution. Instead, the evaluated statement will be printed into the Console window.
These breakpoints are not-suspending, so you can choose to keep them. Your code will only hit the breakpoints when you run the app in debug mode. You don't need to perform any further work for the release version.
However, if you wish to remove them all at once before release,
1. Press Ctrl + Shift + F8 to open the breakpoints dialogue box.
2. To select all breakpoints, use Ctrl + A.
3. Use Alt + Delete to remove the breakpoints you've selected.
We also have an android developer community on WhatsApp where we enjoy learning and sharing everything android, including live sessions, interview preparation, job referral, tutorials, and Q&A. Join us if you're interested.
https://bit.ly/adc-whatsapp-02?(Join this if the first group is full)
Android Developer
2 年Saved ??