Connecting android emulator in another machine

2019-08-14 16:40发布

问题:

I need to test my android app 24h day and I have 3 ubuntu boxes to do it. I would like to connect my development system (MOTODEV Studio 1.3) to a Remote Device.

Well, the interface ask me about ip for machine and port to connect to.

But it doesn't. I found that the adb sever on remote seems not to listen to external ports, only internal loopback, making connections machine-machine impossible.

Could it be true? If so, why there is a section on Device to connect to Android Remote Device on MOTODEV Studio?

I've found an explanation and a workaround in this post (http://rxwen.blogspot.com/2009/11/adb-for-remote-connections.html) but it seems complicated and post's links doesn't work, so I'm confused whether there is a solution to do that.

I seem so simple..... I cann't beleave there is not a way.

回答1:

The Remote device feature of MOTODEV Studio is intended for TCP/IP connections to a remote phone. It requires a lot of manual intervention at this point to get things working and it's an area where we're definitely in need of better documentation.

I don't have the full workflow in front of me, but the steps you need go like this...

  1. Connect phone to remote host.
  2. Using adb shell on remote host, set the phone to connect over TCP/IP rather than USB. You'll need to find the IP address of the phone manually. If you're using a Motorola phone and the Motorola drivers, it's probably 192.168.16.x
  3. Set up port forwarding from the remote host to the phone for the debug ports (probably 5554 or 5555).
  4. From the local host, set up the address of the remote host in the IP field.
  5. When choosing "Run as" or "Debug As" from the local host, you need to choose the remote device as your target.

We intend to make this workflow more automated in the future, but for now you have to do this manually. It's my observation that remote debugging of embedded systems is still slow and prone to problems with latency and line quality, regardless of whether we're talking about phones or reference boards.

Good luck.