Using the Visual Studio Emulator for Android from Android Studio or Eclipse with ADT

John Kemnetz

Since announcing our fast, free, Hyper-V compatible Android emulator, we’ve heard that some of you are using Android Studio or Eclipse as your primary Android development environment and still want to acquire the best emulator on the planet without necessarily having to also install Visual Studio.

That’s why we’re excited to announce that we’ve made the Visual Studio Emulator for Android available without needing to also download Visual Studio. Regardless of how you get our emulator, let’s talk about how you can use it with any Android developer tools of your choice.

Getting started

You can download the emulator directly here or from our VisualStudio.com page. Once you’ve installed the emulator, an entry will appear in your start menu for the “Visual Studio Emulator for Android.” Clicking this will bring up our emulator manager, which allows you to install and start device profiles. By default, we’ve installed a few KitKat profiles so you can quickly get up and running.

On your first launch, we ask that you activate a free license by signing in to an Azure Active Directory or Microsoft Account. If you’ve used any Microsoft service before (eg. Office 365, Azure, Windows Live, sign in with Windows), that same account will work here. If you’d rather wait to sign in, you can click “Not now, maybe later” underneath the sign-in button to defer activating your free license for 30 days. If you do not have a Microsoft Account, you can create one first here, then return to the sign in dialog and use your newly-created account.

Once you’re in the emulator manager, you can start the emulator by clicking the green “play” button. To learn about all of the cool features of the emulator, check out this blog post.

Work in Android Studio or Eclipse with ADT

The emulator connects to ADB (Android Debug Bridge) as if it were a USB-connected device, but here’s a few tips for a smoother experience using Android Studio or Eclipse with ADT.

Android Studio

By default, Android Studio will want to debug to the slow Android SDK emulator. You can configure Android Studio to allow you to select a target by doing the following:

  1. In Android Studio, go to the Run menu and click Edit Configurations…
  2. Under Defaults / Android Application, set Target Device to Show chooser dialog
  3. Check Use same device for future launches

 

This will prompt you to select an ADB-connected device when you debug the first time, then remember that device for subsequent debugging sessions.

Another tip is to create a toolbar item for tasks like quick-launching the emulator manager or starting particular device profile. To do this,

  1. Go to File > Settings >* External Tools*
  2. Click Add

  3. In the Create Tool dialog, enter a name and description for the task, then fill in the Program & Parameters with the following values (depending on the task):
Task Program Parameters
Quick-launch a particular profile  C:Program Files (x86)Microsoft Emulator Manager1.0emulatorcmd.exe  /sku:Android launch /id:[id of profile you want to launch]
 Open emulator manager  C:Program Files (x86)Microsoft Emulator Manager1.0emulatormgr.exe  /sku:Android

You can get the id of a profile by running emulatorcmd.exe /sku:Android list /type:device

2. Click *OK to finish editing the external tool, and OK again once you’ve added all of your tasks to close the Settings dialog.

  • Right-click on the Android Studio toolbar and click Customize Menus and Toolbars…

  • 3. Under Main Toolbar, identify where you want the new toolbar icon to appear, and click Add After…

  • Pick the external tool you created under External Tools and click OK.

  • 4. Click OK again to close the Menus and Toolbars dialog

    Now you’re all ready to quickly start profiles and use the emulator manager directly from Android Studio!

     

    Eclipse with ADT

    The steps for Eclipse with ADT are very similar to those above, with these modifications:

    • The option for picking a device before debugging is under Run > Debug Configurations… > Navigate to the Target tab and select Always prompt to pick device

    • External tools are configured under Run > External Tools > External Tools Configurations… The terms Location and Arguments replace Program and Parameters in Android Studio

    • The entry will appear automatically on your Debug toolbar in the External Tools Run dropdown

    Wrap up

    We at Microsoft are excited to be able to offer you a fast, fully-featured emulator for free and available as a standalone download here. We’d also love to hear your feedback to help us build an even better emulator for Android developers, so drop us a line in the comments, use the Send-a-Smile tool in Visual Studio or in the Emulator Manager, and ask us for help on StackOverflow using the android-emulator and visual-studio tags.

    1 comment

    Discussion is closed. Login to edit/delete existing comments.

    • MUNEZI B 0

      I used these simple steps to connect the Visual Studio Android Emulator with Android Studio 4.0

      This method works even if the emulator is running on another computer, as long as it is on the same local network.

      1. Start the emulator and check its IP address: settings > Wi-Fi > Wired eth1
      2. Enable usb debugging on the emulator device.
      3. Run Android Studio and open your project
      4. Navigate to adb.exe location in Android Studio (default location: %LocalAppData%\Android\sdk\platform-tools)
      5. Run
        adb connect localhost:5555

        from this location, where localhost is the IP address of your emulator

      That’s it. Android Studio connects to the emulator.

    Feedback usabilla icon