Skip to content

Instantly share code, notes, and snippets.

@krazylearner
Last active May 3, 2024 14:12
Show Gist options
  • Save krazylearner/b97d049cf87a818b63eb to your computer and use it in GitHub Desktop.
Save krazylearner/b97d049cf87a818b63eb to your computer and use it in GitHub Desktop.
set up jdb with android

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 ...

Using the jdb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment