Debug Android emulator remotly

When developing apps for Android I’m using Xamarin and Visual Studio. I’m running Windows under Parallels.Therefor I can’t use the x86 emulator with HAXM for hardware acceleration. But Android emulator is really slow without hardware acceleration, because of that i running the emulator on the host OS, in my case OS X.

To set up remote debugging there are a few steps to follow.

  • Enable “Remote Login” in OS X. You find it under “System Preferences” – > “Sharing”.
  • Install the Android SDK on the host OS.
  • Open SDK manager and install the Intel x86 Atom System Image for the API version you want the emulator to run on. If you have Xamarin Studio installed I think that is the easist way to start the SDK manager.

SDK Manager

 

Create emualtor dialog

  • Start your new emulator, if it start and using HAXM successfully you will se the text “HAX is working and emulator runs in fast virt mode” during the startup process.
  • Kill the adb server on the host OS using the command adb kill-server.
  • Kill the adb server on the guest OS using the command adb kill-server.
  • Install Putty on your Windows machine, that can be downloaded from here, http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
  • Open Putty and type the hostname or IP address to your host OS.
  • Under SSH -> Tunnel, configure port forwarding on port 5554 and port 5555.

Putty

 

  • Open a new session and type your login credentials when Putty asks for them.
  • Start the adb server on the host OS using the command adb start-server. To verify that the emulator is connected use the command adb devices. 
  • You will now be ready to start debug your app in the emulator remotely.

One thought on “Debug Android emulator remotly

  1. Steps to take if the emulator doesn’t show up in Visual Studio.

    1. Start putty with the configuration above and log in using your Mac OS X credentials
    2. Start an ADB Command prompt in Windows
    3. execute “adb devices”
    4. If the list is empty, execute “adb kill-server”
    5. execute “adb devices”. If everythings alright the emulator should be listed.
    6. Restart Visual Studio if the device doesn’t appear in the list of emulators.

    The reason for this is that the ports 5554 and 5555 is already bound to your local server and it needs to be killed before the tunneling to your mac will start to work.

Leave a Reply

Your email address will not be published. Required fields are marked *