Android Debugger in action
Have you ever tried Android Debugger ?
if no then this blog is surely for you…
What Android Debugger do basically?
Examine variables and evaluate expressions at runtime.
We can check what’s inside the variable at run time. Not only the variable, in debug mode we can watch the system as well as custom threads. Thus this is a great tool for the multi-threaded app and help in debugging the possible cause of the problem.
How to attach debugger to your app?
Rather than running your application you can press debug button in android studio to attach the debugger with you application. Alternatively, we can debug app using ‘Shift + F9’.
How to set breakpoints and watch value contained in the variables?
You can simple set a breakpoint on any statement by mouse1 click.
What happen basically in setting break point is all the threads are suspended for a moment(default feature can be change). Also breakpoint breaks the execution of the source code at that instant.
Debugging on setting breakpoint:
- To examine the object tree for a variable, expand it in the Variables view. If the Variables view is not visible, click Restore Variables View .
- To evaluate an expression at the current execution point, click Evaluate Expression .
- To advance to the next line in the code (without entering a method), click Step Over .
- To advance to the first line inside a method call, click Step Into .
- To advance to the next line outside the current method, click Step Out .
- To continue running the app normally, click Resume Program
. . .