How to debug project, Android Studio

Android Studio: Debug Project

This post is for beginners, to give basic understanding to debug project in Android Studio.

To debug Project, you have to place breakpoints at the code line, of a method or class, So the debugger will stop at that break point while debugging.
To place a break point just click on  work space left side border you can see red dot. To remove breakpoint just click on red dot again.


To debug a project from starting screen of your app, You have to click on the Debug menu button, or Press Shift+ F9

*generally, while debugging app slows down.

So, You can use another debug option to debug at a Specific Screen.
At times you may want to debug code in a Specific screen at a particular line for eg. on a Save button click event method.

So, Place a breakpoint at that particular onClick(View v) method.


And just run the app by clicking Run menu button


After running app on device or emulator, navigate to the Specific screen and just before clicking on Save button(button event where you want to debug code) in screen. Click on Attach debugger to Android Process menu button in Android Studio work space.


You’ll see a dialog to select a process, here select your process (and wait for a moment for debugger to attach to process) and now click on the Save button in that Specific screen. You can see Debug console at the bottom and debugger waits at break point at a specific line to enable you start debugging.

debug project

Here I just like to explain few useful debug console button functionalities

Press F8 or click on the below debug console button icon, to move debugger to next line.. and so on…


Press F7 or click on the below debug console button icon, to move debugger to in to a inner class method.(This is very rarely used). Use it whenever a method call is escaping from debugging.


Press F9 or click on the below debug console button icon, to execute code up to next break point..


Press Ctrl+F2 or click on the below debug console button icon, to stop debugger execution, when you click on this button, debugger stops execution and app runs normally.


these buttons are mainly used for debugging. If you understand these button functions first then You can see and understand other button functions easily.

You can see all variables data and instances data of Specific screen in Variable section…


Hope it makes sense and helps somebody.

cheers 🙂

You may also interested in

Debug code in a class that’s inherited Service – Android

Debug code in a class that’s inherited Service

Whenever you implemented Service to do some background work, at times you may require to debug code in it. So, If you try debugging by placing a breakpoint, debugger won’t stop at the breakpoint in a Service class.

To make it wait at breakpoint and to debug code, call the following method in OnCreate() method.


debug code

So, Now you can try debugging.

Note: Comment the above code line, If its not require to debug code.

ref link: