我一直在尝试将 jdb 连接到 android 模拟器一段时间,并且反复遇到:
jdb -sourcepath ./src -attach localhost:8700 java.io.IOException: shmemBase_attach failed: The system cannot find the file specified at com.sun.tools.jdi.SharedMemoryTransportService.attach0(Native Method) at com.sun.tools.jdi.SharedMemoryTransportService.attach(SharedMemoryTransportService.java:90) at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:98) at com.sun.tools.jdi.SharedMemoryAttachingConnector.attach(SharedMemoryAttachingConnector.java:45) at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:358) at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:168) at com.sun.tools.example.debug.tty.Env.init(Env.java:64) at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1010) Fatal error: Unable to attach to target VM.
不是很好。解决这个问题的最佳方法是什么?我在 Windows 7 64 位上运行。
最佳答案
目前这对我有用——创建套接字而不是共享内存连接。
>jdb –sourcepath .\src -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8700
在此之前,您需要进行一些设置——例如,查看这组 useful details on setting up a non-eclipse debugger .它包括一个设置初始断点的好技巧——在您的主目录中创建或编辑一个 jdb.ini 文件,其内容如下:
stop at com.mine.of.package.some.AClassIn:14
它们将被加载并延迟到连接。
编辑:忘记引用 Herong Yang's page .
关于java - "Failed to attach to the remote VM"连接jdb到windows上的android模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4220174/