方法1
By hheimbuerger
Here is how I solved it on Windows. I pretty much followed Christopher's lead, but I can't edit, so a new answer will have to do.
The problem I had was that ADB as well as the emulator was just listening on 127.0.0.1, not 0.0.0.0, for me. Otherwise I would have usedTCPMon. I guess this is either different on Windows, or has changed with the latest versions of the SDK. (You can check withnetstat -ban.)
-
I installed WinSSHD on the machine that runs the emulator. (I believe it should work with freeSSHd as well, but I couldn't get a login working there.)
-
I opened port 22 (TCP) in the Windows Firewall. (WinSSHD might be able to do that for you.)
-
I created a virtual account in the WinSSHD GUI.
-
I created a new PuTTY connection from the development machine to the emulator machine and made sure I could connect.
-
Then I set up tunnelling in PuTTY: Connection -> SSH -> Tunnels
Source port: 5554
Destination: localhost:5554
Type: Local/AutoSource port: 5555
Destination: localhost:5555
Type: Local/Auto(Connect and keep PuTTY open, to maintain the tunnel.)
-
Now I fired up the emulator on the remote machine and made sure that ADB is not running there.
-
I restarted ADB on the development machine (
adb kill-server, thenadb start-server). -
adb devicesand the remote emulator showed up asemulator-5554 device. I could now deploy and run my app straight from Eclipse/ADT, where the emulator showed up under Virtual Devices as if it was a local emulator.
本文介绍了解决Windows环境下ADB无法直接连接到运行在虚拟机上的Android Emulator的问题,通过设置WinSSHD、打开防火墙端口、创建虚拟账号及配置PuTTY进行远程端口转发,实现了ADB设备的正常识别与操作。


257

被折叠的 条评论
为什么被折叠?



