views:

1363

answers:

6

Is it possible to write the code/compile Android application on one machine and debug it remotely on the emulator launched on another? I'm sick and tired of the emulator constantly eating half of my laptop's processor.

A: 

I seem to recall hearing that MOTODEV Studio for Android offered this feature, but I don't use it personally.

CommonsWare
A: 

I don't have a second machine with the SDK to hand, but I note that the emulator's listen ports (default 5554, 5555) are listening on 0.0.0.0, i.e. reachable from remote machines, and that adb --help shows a connect <host>:<port> command. I assume that would make it show up in adb devices so adb commands work on it. For Eclipse, try "Run / Run Configurations..." and set the Target to Manual. That gives you a "device chooser" which I'm guessing would include a remote emulator if adb is connected to it. Worth a try.

Chris Boyle
+1  A: 

A developer phone is less expensive than an additional computer and can be remote debugged. It has the additional benefit of having all of the optional sensors that the emulator doesn't present by default.

I highly recommend getting a developer phone for testing.

Kevin Williams
+6  A: 
Christopher
+2  A: 

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 used TCPMon. I guess this is either different on Windows, or has changed with the latest versions of the SDK. (You can check with netstat -ban.)

  1. 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.)

  2. I opened port 22 (TCP) in the Windows Firewall. (WinSSHD might be able to do that for you.)

  3. I created a virtual account in the WinSSHD GUI.

  4. I created a new PuTTY connection from the development machine to the emulator machine and made sure I could connect.

  5. Then I set up tunnelling in PuTTY: Connection -> SSH -> Tunnels

    Source port: 5554
    Destination: localhost:5554
    Type: Local/Auto

    Source port: 5555
    Destination: localhost:5555
    Type: Local/Auto

    (Connect and keep PuTTY open, to maintain the tunnel.)

  6. Now I fired up the emulator on the remote machine and made sure that ADB is not running there.

  7. I restarted ADB on the development machine (adb kill-server, then adb start-server).

  8. adb devices and the remote emulator showed up as emulator-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.

hheimbuerger
A: 

Yes MOTODEV Studio has it. But I it doesn't work for me.

(Running in 2 Ubuntu 10.04 boxes that already - two years - have )

Does anybody got it ?

Juanin