Language: EN

usar-el-emulador-de-android-de-visual-studio-en-android-studio

Using the Android Emulator from Visual Studio in Android Studio

If you develop applications for Android, you will have suffered that the most complicated part is not the development itself, but the development environment (IDE). The installation is slow and complicated, the emulator is simply terrible, and it is much harder to configure the environment to your liking than to develop the application itself.

The situation improved slightly with the release of Android Studio, which replaced Eclipse as the standard IDE for programming on Android. However, the Android SDK emulator is still unbearably slow.

Interestingly, with the release of Visual Studio 2015 (free in its Community Edition version), Microsoft has included an Android emulator. This Microsoft Android emulator is, ironically, much faster and more powerful than Google’s own emulator.

In this post, we are going to configure Android Studio to use the Visual Studio 2015 emulator.

Installing

We will start by installing the necessary software, if we do not already have it installed. Like this:

  • Download and install Android Studio from this link.
  • Download and install Visual Studio 2015 Community Edition from this link. Make sure to check the option to install the Android emulator.

Alternatively, we can install only the Visual Studio Android emulator from this link.

Let’s have a good coffee while everything necessary is downloaded and installed.

Preparing Visual Studio Emulator

We run Visual Studio Emulator, and we launch an instance of a device to make sure that everything is configured and works correctly.

android_emulator_1

Next, we need the ID of one of the machines. To do this, we open a command prompt and type

"c:\Program Files (x86)\Microsoft Emulator Manager\1.0\emulatorcmd.exe" /sku:Android list /type:device"

android_emulator_2

We copy the identifier of the machine that we want to use as an emulator.

Configuring Android Studio

Next, we open Android Studio and apply the following options,

  • We enter the “Run” menu and select “Edit/Configurations”.

android_emulator_3

“Default/Android Application”, we set “Show choose dialog” as the Target Device and check “Use the same device for future launches”.

android_emulator_4

This will make Android Studio ask us for a connected ADB device when we debug the application, and it will remember this device for future sessions.

Now we are going to create a button that allows us to launch the Visual Studio 2015 emulator directly. To do this,

  • We enter “File/Settings”.

Android_Emulator_5 button.

android_emulator_6 following values.

program: c:\program files (x86)\microsoft emulator manager\1.0\emulatorcmd.exe parameters: /skulaunch /id:00000000-0000-0000-0000-000000000000

android_emulator_7

Where you have to change 00000000-0000-0000-0000-000000000000 with the ID of your machine, which we obtained previously.

  • We click on the right button above any toolbar.

android_emulator_8

android_emulator_9

Within the “Main toolbar” group, we select the icon after which we can place our new button, and select “Add after” (in the example’s case, I have placed it behind the Forward button).

Android_Emulator_10

  • As the action to be performed by the button, we select the external tool that we previously created.

Android_Emulator_11

Android_Emulator_12

We have now correctly configured Android Studio to launch the Visual Studio emulator. We try running an application to verify that we have completed the process correctly.

android_emulator_13

Now we can develop software with an efficient Android emulator and launch it directly from our button in Android Studio.