Using the Visual Studio Emulator for Android from Android Studio or Eclipse with ADT
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.
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.
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:
- In Android Studio, go to the Run menu and click Edit Configurations…
- Under Defaults / Android Application, set Target Device to Show chooser dialog
- 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,
- Go to File > Settings > External Tools
- Click Add
- 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 Manager\1.0\emulatorcmd.exe /sku:Android launch /id:[id of profile you want to launch] Open emulator manager C:\Program Files (x86)\Microsoft Emulator Manager\1.0\emulatormgr.exe /sku:Android
*You can get the id of a profile by running emulatorcmd.exe /sku:Android list /type:device
- 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…
- 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.
- 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
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.