Debugging can be done by either creating log statements which will execute at the
runtime or set the breakpoints.
Debugging by setting breakpoints.
In order to start with this debugging, you need to enable the debugging. To do this follow the steps –
1. Install LLDB from the SDK Manager.
2. Enable debugging on your device.
3. Run a debuggable build variant: You need to simply do this in your build.gradle file
To start debugging follow the steps –
1. Set some breakpoints in your code.
2. Click the debug button from your android studio toolbar
3. This will open a window with the connected devices, simply select any one and click Ok.
4. This action will open a debug window showing current thread and object tree for the variable.
5. If you want to move to the next line while debugging you need to click on f7.
Debugging by log statements.
To generate the log you need to look at the log monitor which is situated at the bottom of the android studio.
This will show all the log details to you.
you can insert the various log comments from your code, for example, to insert verbose you need to write-
there are various types of Logging statements you can write for various purposes -
1. Log.e(String, String) (error)
2. Log.w(String, String) (warning)
3. Log.i(String, String) (information)
4. Log.d(String, String) (debug)
5. Log.v(String, String) (verbose)