start bluestack or emulator install app on it start the app
connect adb to emulator
$ adb connect localhost:5555
get 'pid' of your app .Dont forget to run it first in emulator
$ adb shell ps
confirm the pid
$ adb jdwp
forward a local socket to PID 290 to start debugging.
$ adb forward tcp:8700 jdwp:290
This tells adb to forward a local socket on port 8700 to the app with PID 290 that’s hosting a JDWP transport.
start debugging the simple test app
$ jdb -attach localhost:8700 -sourcepath /path/to/test/app/src.
on error try this instead of above command
$ "C:\Program Files\Java\jdk1.8.0_45\bin\jdb" -sourcepath ./app/src -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8700
If all goes well, you’ll have a jdb prompt in which you can start adding breakpoints.
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...