12

Can't seem to find the following information although I'm pretty sure this should be possible: I'm running an Android emulator on a machine A. I'm developing on another machine B in which I'm using Eclipse.

Now when I switch to the DDMS perspective in Eclipse, I want the emulator from machine A to show up in the devices tab.

The reason is, that the emulator is quite slow and it looks like running development and emulator on different machines might be a solution.

Since the emulator runs on a specific port, I'm pretty sure I just need to figure out how to tell eclipse where to look for emulators.

Thanks for any tips

6 Answers 6

2

You can tell adb to connect to a device listening on an IP address and TCP port. That device should then show up in eclipse. So the debug machine is easy.

The emulator machine may be harder. The emulator is listening for TCP connection on a local port. IIRC it has been established that there's no command line switch to make it listen on an external interface, though double check that. So you might have to modify and recompile the emulator, or use some kind of port-forwarder on the hosting machine. ssh might handle that for you though I'm sure there are other tools without the encryption overhead if that's not needed.

0
2

In the meantime, I found a very nice solution to the problem. I installed android-x86 (http://www.android-x86.org) in a virtual machine. On the host, you then use the following commands to restart adb and connect to the vm:

adb kill-server
adb connect <VM-IP>:5555

Replace VM-IP with the actual IP of your virtual machine. If you're on a private network, the easiest way is to configure vm network as bridged so the VM gets its own IP address from the dhcp server. Should also work with Host-Only networks though as described here.

If all went well, you should see the android VM in the Eclipse debugger just like normal emulators.

2
  • Actually, the first command kill-server is not necessary, you can directly connect to a new device calling adb from the console.
    – pgruetter
    Commented Mar 31, 2011 at 18:20
  • And to find out the ip of the vm, remember that you can use i.e. Ctrl+2 to switch to a console to find out your ip address with ifconfig, and switch back to the "android os" with Ctrl+7.
    – pgruetter
    Commented Mar 31, 2011 at 18:21
1

Eclipse doesn't attach to the emulator directly.

The adb background process controls communication with the emulator (as well as real devices). Adb listens on TCP port 5037 for incoming commands.

I haven't tried your scenario but this should get you started.

1
  • OK, thanks for the information! Maybe there is a way to change adb so it also checks certain other hosts for emulators. Or I can change the adb completely so adb itself runs on another host.
    – pgruetter
    Commented Dec 12, 2010 at 21:24
1

I did it with the following steps.

  1. Start the emulator on the remote machine
  2. Start a port forwarding application on the remote machine (forwarded tcp:5557 to localhost:5555)
  3. Start adb with connect remote_machine_IP:5557 on my development machine
  4. Start eclipse

Eclipse will find adb and list the device.

2
1

Follow these steps to connect your VM to eclipse IDE:

First run ICS from your VM and open up android command prompt. (Navigate to applications and run Terminal Emulator)

Type "netcfg" in terminal to find out IP of your vm

Then go to cmd(windows command prompt) and move to "platform-tool" folder in your android installation path(in my case cd C:\android-sdk-windows\platform-tools)

Then type "adb connect your ip" command (adb connect 190.156.10.122)

Now you can debug your android application in vm without pain. Try this and this

1

After struggling with this, I found this video that explained how to get emulator running on my mac while running my dev environment in a VM. http://youtu.be/CacpPleWsZM

1
  • this video is very detailed, step by step in guide. thanks for sharing this
    – MichaelP
    Commented Sep 8, 2013 at 9:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.