Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

The Podcast at Delphi.org: Debugging Against a Remote Android Emulator

$
0
0

The Android emulator is impossibly slow when running inside a virtual machine. It is possible to debug against a remote emulator via SSH. Here are the steps to connect from a Windows guest OS to an OS X host OS (they can be easily adapted for a Windows host). It does require installing the Android SDK on the host OS and creating and running an emulator there. It seems to work even if you have a device connected too. I’ve gotten them both to show up in the IDE and am able to pick between them and deploy and run on the emulator.  The Emulator is still slower than hardware, but this makes it usable.

This could be adapted to debug against a remote Android Emulator running on a remote machine located anywhere on the internet. Just requires port 22 to be open between the two machines.

Thanks to hheimbuerger for the the Stack Overflow answer that got me pointed in the right direction. This information has been adapted to the DocWiki too with additional links to more information.

  1. Install the Android SDK (not the ADT bundle) on your Mac OS X host & start an ARM based emulator (With use Host GPU enabled)
  2. Enable SSH on the host
    • On a Mac OS X Host go to System Preferences -> Sharing -> Remote Login
    • On a Windows host, you need to install a 3rd party SSH host. FreeSSHd has been found to work.
  3. Install the PuTTY SSH (putty.exe) client on the Windows Guest OS
  4. Ensure port 22 is open between the Windows guest OS and the Mac OS X host.
  5. Create a connection in PuTTY to the Host OS
    1. You will most likely use the 192.168.x.x IP address of the host
    2. Go to Connection -> SSH -> Tunnels and add a local/auto port forwarding for 5555 to locahost:5555 and 5554 to localhost:5554.
  6. Save and Open the connection in PuTTY
  7. Provide the login credentials for the Mac OS X host – anything typed in this window is executed on the remote machine
  8. You can check or change the tunnel settings via the icon in the upper left of the PuTTY window
  9. Minimize PuTTY (keep it open to maintain the SSH connection)
  10. Open a new command window in the Windows guest OS and type “adb kill-server & adb devices” and you should see the emulator-5554 as a listed device.
  11. Refresh target devices in Delphi and it should appear

PuTTY Tunnels

This should work for any emulators or devices connected to the remote machine. Unlike emulators that are local, you need to start the emulators before Delphi will see them. You may need to adjust the tunnel port numbers if you are connecting multiple devices.

Good luck, and happy debugging!


Viewing all articles
Browse latest Browse all 1725

Trending Articles