"Failed to attach to the remote VM" connecting jdb to the android emulator on Windows
Currently this is working for me -- making a socket rather than a shared memory connection.
>jdb –sourcepath .\src -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8700
Beforehand you need to do some setup -- for example, see this set of useful details on setting up a non-eclipse debugger. It includes a good tip for setting your initial breakpoint -- create or edit a jdb.ini file in your home directory, with content like:
stop at com.mine.of.package.some.AClassIn:14
and they'll get loaded and deferred until connection.
edit: forgot to reference Herong Yang's page.
Try quitting Android Studio.
I had a similar problem on the Mac due to the ADB daemon already running. Once you quit any running daemons, you should see output similar to the following:
$ adb -d jdwp284621939^C$ adb -d forward tcp:7777 jdwp:1939$ jdb -attach localhost:7777 -sourcepath ./srcSet uncaught java.lang.ThrowableSet deferred uncaught java.lang.ThrowableInitializing jdb ...>
See my other answer to a similar question for more details and how to start/stop the daemon.
Answer #1: Map localhost in your hosts file, as I linked to earlier. Just to be sure.
Answer #2: If you're using shared memory, bit-size could easily become an issue. Make sure you're using the same word width everywhere.