Eclipse
1- Make sure you have the application project code in Eclipse (you cannot debug the application if you don't have one).
2- Open perspective DDMS (window> Open perspective> Other> DDMS)
3- On the "Devices" tab, select your device and expand it if necessary.
4- Select your application (you will see the package name)
5 Click the little error icon next to the Devices tab to attach the debugger.
Android Studio
Click the Attach Debugger icon. This is the one on the right in the figure below.

Alternatively, you can access this function from the Run menu> Attach Debugger to Android Process.
You will be presented with a dialog showing connected devices and running applications that you can debug.
Select a process and click OK.
source share