Introducing Visual Studio’s Emulator for Android
November 12, 2014
This post was updated in July 2015 to reflect the latest changes.
Microsoft Visual Studio 2015 now has options for Android development: C++, Cordova, and C# with Xamarin. When choosing one of those Android development options, Visual Studio will also install the brand new Visual Studio Emulator for Android to use as a target for debugging your app. You can also download the emulator without needing to install Visual Studio. For more, watch this video teaser or see it in action.
Before I walk you through using this new emulator, let’s talk about why we are building an emulator for Android – feel free to skip the next section to go to the interesting part 🙂
The need for an emulator for Android
We know that emulators can play a key part in the edit-compile-debug cycle (bigger part than devices) and we believe that you need an emulator like the one we are releasing today.
Having a great emulator to debug against doesn’t mean you don’t need a device, and having a device to debug against doesn’t mean you won’t benefit from a good emulator. They are complementary.
You definitely need to test against a device for the following scenarios which are unsuitable for any emulator:
- Measuring the performance characteristics of your code. While an emulator can help you with correctness issues, it will never perfectly emulate the performance characteristics of your code running on the actual devices that you want to test against. You want to measure the performance as your users see it.
- Testing hardware-specific issues. If what you are trying to test is the touch-responsiveness of your game, or the speaker quality for your media app, you will want to do that type of testing on the target devices. Ditto if you are trying to work around an OEM-specific bug.
- Purely evaluating the actual user experience in real-world situations, e.g. do your designed interactions work for a user walking around using your app one handed with just their thumb alone?
For all other testing, which as part of your edit-compile-debug cycle normally takes at least 80% of your time, you’d want to use an emulator (barring other blocking issues or limitations with your emulator of choice). Use an emulator for the following reasons:
- The majority of your testing is for correctness issues (not performance) and the majority of your code is probably not dealing with hardware specific issues. So use an emulator!
- You don’t want to spend a bunch of money buying a bunch of devices (and keep doing so every time a new device appears on the market), just to test things like screen resolution, DPI settings for different screen sizes, different API levels / platform versions, when you can configure that in software (in an emulator).
- You don’t want to have to take physical action with your device to test some sensor, e.g. respond to movement or location changes or simulating network/battery changes. Instead you want to simulate the sensor values easily and quickly in an emulator, e.g. simulate a trip to another town while your app responds to the change of location.
- There is also the convenience element. Connecting to a device (typically dealing with cables), managing that connection and its lifetime, using one of your USB ports, is not as simple as launching the emulator and treating it like every other desktop application running on your dev machine.
So emulators are great and can be a key part in the edit-compile-debug cycle and we want to make sure that our emulator is best-in-class. You have told us about several pain points with existing emulators that we are starting to address with our release:
- Slow. This is the number one complaint we’ve heard from Android developers. “The emulator is painfully slow, it hurts my productivity, and I’ll use a device.” Slow is not acceptable. If anything, using the emulator should be faster than using a device so you can test your scenarios faster (remember, you are not using emulators to test the performance of our code, you just need them to be as fast as possible for your own use).
- Conflict with Hyper-V on Windows. Many emulators require you to disable Hyper-V or don’t work as well with Hyper-V as they do without. Using Hyper-V is part of the development setup for many developer activities, so asking you to restart your machine (multiple times a day) to toggle Hyper-V is not acceptable.
- One specialized variant of this is using the Windows Phone emulator (which itself is based on Hyper-V). It is a real pain having to make changes and reboot every time you want to switch from an Android emulator to a Windows Phone emulator to test your cross-platform code.
- Additional acquisition and installation step. If your main development environment is Visual Studio, you don’t want to have to acquire the emulator separately and follow a separate installation process.
- Separate cost. Having a great emulator that can cost you as much as your main development environment is not an option for most. The Visual Studio Emulator for Android comes with VS without additional charge and is also free when acquired without VS.
In short, we will address all of those pain points with the Visual Studio Emulator for Android. Now, let’s recap Visual Studio’s debugging story for Android and how to choose the VS Emulator for Android.
Debugging against the Visual Studio Emulator for Android
With Visual Studio 2015 you can target Android and edit-compile-debug regardless of your choice of programming models: JavaScript (or TypeScript) with Cordova, C++, or C# with Xamarin.
With all three of those choices, when you start debugging, you must first choose a target. That target can be a device, or it can be one of many emulators that you may have running on your machine. Let’s see how to choose a debug target for Cordova, C++, and Xamarin in Visual Studio 2015. To target the Visual Studio Emulator for Android, you can either select one of the pre-installed device profiles that appear in the Debug Target dropdown or use the Emulator Manager to install and start a different device profile (see the “Device Profiles” section below for more on that method).
With C++ projects, the Debug Target dropdown looks like this:
Device profiles that have been started through the Emulator Manager will also show up in this list. Make sure “x86” is selected as the architecture. With Cordova projects you will want to pick the last four entries in the Debug Target menu or choose the “Device” option if the emulator is running a device profile not in the list, as per the following screenshot:
(definitely avoid picking the option “Android Emulator” as that is the slow one that comes with the SDK)
With Xamarin projects, the option looks like this:
Once you have chosen your debug target and hit F5, your app will be deployed to the emulator, as per the regular VS debugging flow you can hit breakpoints in your code, see the call stack, inspect variables, etc. So now that you know how to use the emulator for debugging, let’s continue exploring its cool features!
The emulator is ADB-connected, so it also works well with your Eclipse and Android Studio projects. Read more on how to setup Eclipse and Android Studio to easily debug to the emulator.
You can even debug & test WebGL and HTML5 on the emulator.
Sensor simulations and other capabilities of the Visual Studio Emulator for Android
Beyond using the emulator as a deployment target, you can also take advantage of sensor simulation and other capabilities – let’s examine a few of those, in no particular order.
Zoom
You can change the size of the emulator as you see it on your development machine (the host). The dots per inch (DPI) for the emulator is based on the host monitor DPI, regardless of the zoom value. This allows you to scale the emulator in case it is taking too much space on your desktop.
To change the size, use the “Zoom” button on the emulator’s vertical toolbar.
You can also use the “Fit to Screen” button above the “Zoom” button to fit the emulator on your screen.
If you are going to take screenshots of your app running in the emulator (e.g. with the Snipping tool) for best results remember to set the zoom level to the maximum of 100% – or even better, use our built-in Screenshot tool support that I describe below.
Orientation / Rotation
Unless your app only supports a fixed orientation, you should test how your app responds to orientation changes, and what it looks like in portrait, left-landscape, and right-landscape orientations. Simply rotate the emulator left or right with the two corresponding buttons on the vertical toolbar: “Rotate Left” and “Rotate Right”. The size of the emulator remains the same when you rotate.
Network Info
The emulator reuses the network connection of the host machine, so there is nothing for you to configure.
You can also review the emulator’s current network settings. On the vertical toolbar click on the “Tools” button to show the “Additional Tools” fly out panel, and then click on the “Network” tab.
You can also setup the emulator for monitoring HTTP traffic with tools like Fiddler.
Location (GPS)
If your app does anything with navigation, geofencing, walking/biking/driving, then you will love the location and driving simulation in the emulator under the “Location” tab when you open the “Additional Tools”.
You can navigate the map by dragging it around, by zooming/in and out, or even by searching for a location. You can place and remove pins on the map, thus creating map points. Those appear as latitude longitude coordinates in the list in the bottom left. From the toolbar at the top you can even save those map points to an XML file and later load them from the file.
Instead of having each map point immediately change the GPS location of the emulator (“Live” mode), you have other options too! You may want to place a few map points and then simulate transitioning between those points. To do that, at the toolbar at the top switch from “Live” mode to “Pin” mode. Then you can press the small play button at the end of the toolbar to transition between the map points. You can even enter a transition interval (in seconds).
Finally, you can choose a third mode that is similar to “Pin”, which is called “Route” mode. In this mode you can also simulate transitions between the points but with some additional twists. The simulator will calculate an actual path between the points and generate invisible points at 1 second intervals between the points you choose. The overall speed at which it will play those points is determined by a second setting and your options are: “Walking” (5 kilometers per hour), “Biking” (25 km/h), “Speed Limit” (variable dependent on map point), and “Fast”.
Accelerometer
If your app tracks and responds to movement of the phone, you can test them using the “Accelerometer” tab when you open the “Additional Tools”.
Simply click and hold the red dot in the middle and drag it towards the directions you want to simulate, within the 3D plane. As you do that your app will receive movement events if it has registered for them.
You can also see the X, Y, Z values in the bottom left. Under those values you can “Reset” to the starting position, and also pick the starting Orientation from these values: Portrait Standing, Landscape Standing, Portrait Flat, and Landscape Flat.
Lastly you can simulate the phone shaking by clicking the “Play” button in the bottom right. The only visual indication that a shake is taking place are the values of the X,Y,Z and when they stop rapidly changing you’ll know the shake is over.
Power/Battery Simulation (and Power button)
If you write your app to respond to battery charge changes, then you will like the emulator’s ability to simulate that by switching to the “Battery” tab when you open the “Additional Tools”.
There is a slider that allows you to set the exact charge value of the battery. Notice as you slide down/up how the battery icon in the top right changes to reflect the change. Your app can also respond accordingly.
If you change the Battery Charging State to not be “Charging”, then the emulator’s screen will go blank after a timeout period. You can configure the timeout though the built-in regular “Settings” app (look for the “Sleep” option under “Display”). If the emulator sleeps due to this, then you can wake it up through the “Power” button on the vertical toolbar.
Screenshot
To take a screenshot of your app, open the “Additional Tools” and switch to the “Screenshot” tab. Then click on the “Capture” button, which will take a screenshot and show you an instant preview. If you want to keep the screenshot click on the “Save…” button. If you don’t like the screenshot you took, ignore it or click “Capture” again.
The screenshot tab will take the image at the same resolution as is displayed on your screen, so make sure to set zoom to 100% for best results.
Install APKs, files, and flashable zips through drag-and-drop
You install apps on Android through an application package file which is known as an APK. If you have an APK that you want to install on the Visual Studio Emulator for Android, just drag it onto the emulator from Windows Explorer. You will see a message in the emulator indicating progress “Installing foo” followed by a message box “APK foo installed successfully.” Remember to make sure your APKs have code built for x86!
You can also drag and drop other (non-APK) files to the emulator and they will be placed onto the SD Card, including flashable zip files. A popular method for quickly restoring a set of apps, settings, and data to an Android device is to create a flashable zip file. These archives are essentially a set of APKs and other files in a directory structure that matches Android’s. If you drag-and-drop one of these flashable zip files on to our emulator we will unzip the archive and install the files in that directory structure
SD Card
If your app has a need to read or write to the SD card of the target, the emulator simulates that by making available a folder representing an SD card.
Navigating to the “SD Card” tab in the Additional Tools window will let you pick a local folder whose contents will be used to populate the SD card. You can then push files to the SD card or pull files off of the SD card to this directory. Checking the “Delete Existing Contents” box will clear the SD card before pushing files to it for a fresh start.
Having SD card support also allows other built-in Android apps to function, such as the browser downloads and the camera app – which brings me to the next capability.
Camera
Typically you’d be using the camera from your app (using an appropriate API), and we support that. You can also use the built-in camera app directly. When you launch the camera in the emulator you will see a fixed animated image that you can take a snapshot of, simulating taking a picture. You can also navigate to the “Camera” tab in “Additional Tools,” where you can switch the input for Front and Rear Camera to display a default animation, a picture from file, or an attached webcam. Any webcam recognized by Windows will show up in the dropdown lists for front and rear cameras.
Multi-touch
If your app makes use of more than one simultaneous touch point (eg. for pinch functionality), you can select between “Single Point Input” and “Multi-touch Input” on the vertical toolbar that appears next to the emulator display.
Selecting “Multi-touch Input” will overlay three dots. The large outer two dots act as touch points for pinching and zooming, and the inner dot controls the origin for the touch points. If you’re using the emulator on a touchscreen you can also use your fingers to directly interact with the emulator screen.
Audio Playback, Keyboard Text Input…
There are other capabilities that the emulator provides that are taken for granted, even though they require “work” from the product team :-). I won’t list them all here but three of them are that:
- you can use your computer’s keyboard to enter text in the emulator
- any audio coming from the emulator can be heard through your computer’s speakers
- the emulator will appear to be connected to a WiFi network
Device Profiles
It’s no secret that testing your Android app for compatibility across the staggering variety of Android hardware can be a challenge. Android phones and tablets in the market span a wide range of versions and screen sizes and come in many different hardware configurations (RAM, CPUs, architecture, etc.). Making sure that your app works as expected for the most popular devices on the market can be challenging. The Visual Studio Emulator for Android simplifies this by introducing Device Profiles. We’ve curated a set of device profiles that represent the most popular hardware in the market, including devices from Samsung, Motorola, Sony, LG, and more. In Visual Studio 2015 RC, you’ll find a new option in Visual Studio under the Tools menu–a link to the “Visual Studio Emulator for Android…”
Clicking this menu item will bring up our Emulator Manager, with which you can install, uninstall, and start device profiles. By default, we’ve gone ahead and pre-installed two device profiles (KitKat phone/5″ and tablet/7″ configurations), as indicated by the white text and icons. Other profiles in the list will appear grayed out until you click the “Install Profile” button and the installation completes. You can filter the list by API Level (currently 17, 19, 21, and 22) and click the details arrow on the bottom right-hand side of a profile to view its full configuration details.
Once you’ve installed the set of profiles that you’d like to target, you can start these new profiles directly from the manager by pressing the green “Play” button.
Command line interface (CLI)
Whether you’re prepping automated tests that need to spin up a device profile or you’re just a command line junkie, you’ll appreciate the command line interface for interacting with the Emulator Manager. In Command Prompt, navigate to
%programfiles(x86)%\Microsoft Emulator Manager\1.0\
And run emulatorcmd.exe to try it out. Here are the currently supported commands:
- list – list all installed (or installable) profiles or platforms
- launch – launch a specific device profile
- detail – list the details of a specific profile
- install – install a specific profile
- uninstall – uninstall a specific profile
- manage – open up the UI for managing profiles
Note that for all of these commands, the /sku:Android switch must be included. You can also type /help after any of these commands for usage instructions.
We are just getting started, there is a lot more to come in subsequent releases and you can help us prioritize new sensor simulation and other capabilities by letting us know your thoughts in the comments below.
A peek under the covers
If you are interested in how we built the Visual Studio Emulator for Android, the short answer is that we reused the work of others. Conceptually, an emulator consists of 4 pieces:
- A virtual machine (represented as a vhd) of the target you are emulating, in this case Android. We started with the source at the Android Open Source Project (AOSP), evolved it, and configured an x86 virtual image for fast debugging.
- A small shell/chrome that as a user you see and interact with, which loads the virtual image and projects it through a rendering control. Think of this as remote desktop: you are essentially RDPing to the image. We started with the desktop application that is the shell/chrome of the Windows Phone Emulator (internally known as XDE), which is already rich in functionality. Then we made modifications for our Android-specific needs.
- A virtualization technology that XDE needs to load the image before it can RDP to it. Windows has a great virtualization technology called Hyper-V and that is what we used.
- The connection pipeline between VS and XDE and also between the debug engine and the virtual image. Here we reused parts of what existed between XDE and Visual Studio, and also the Android Debug Bridge (ADB) channel.
Now let’s look at some of the limitations we have today, and hopefully you can give us input on which ones we need to address first.
Current limitations
Our goal is to ship frequent updates to the emulator and hope that you will help us do this while keeping quality high by reporting any issues/bugs you encounter. We also have known limitations – please tell us which ones are most important to you so we can prioritize these on our backlog:
- If your app makes direct or indirect use of OpenGL ES 3.0 or higher, it may not render on our emulator. This is because we use the open source ANGLE (Almost Native Graphics Layer Engine) project to convert OpenGL ES calls to DirectX before they are forwarded to run on the host machine’s GPU. ANGLE supports most OpenGL ES 3.0 APIs, but a few have yet to be implemented. However, OpenGL ES 2.0 works correctly.
- If your app takes advantage of the Google Play Services layer then it will not work out of the box in our emulator. That is because when building our Android images we do not include the GMS packages (which require additional licensing that Google apparently is not offering to emulator providers). It is interesting to note how other emulators have addressed this problem, eg. Xamarin and Genymotion. These methods may work in our emulator.
- You need to recompile your code for x86. If you have parts of your code that can only be compiled for ARM, or you depend on 3rd-party libraries for which you do not have an x86 version, your code will not run on our emulator at this point.
- You can only install the Visual Studio Emulator for Android on an operating system where Hyper-V is supported. Examples of where Hyper-V is not supported include Windows 7, non-Windows machines, and inside another Hyper-V VM. We’ve seen some success with running the emulator inside of a VMWare VM when properly configured, but we haven’t done much testing on that, so run at your own risk! One thing we’ve noticed is that OpenGL needs to be disabled when running on VMWare VMs. You can disable OpenGL in the xdesku.xml file.
If any of these limitations are an issue for an app you are developing, then the workaround is to use a device (or find another emulator that may not have the limitation). We will be making this current list of limitations shorter with every release.











this is why i love Microsoft <3
I don't really get this: is this for Xamarin only, or can I now build cross platform apps without Xamarin? #confused
Leon: VS 2015 will support C++ development for Android without any Xamarin products.
and you can build apps in Cordova in visual studio. Plenty of options
Nice!
So no Xamarin.Forms support?
i.e. we still have to struggle with separate UI codes for each platform?
Great!
Xamarin ?? Ok so it's definitive, i QUIT M$ environement
I don't want to deal with that money sucker company
Let me know when I can do the work in Java instead of C/C++ and I will use it instead of Android
Visual Studio for Linux please!!!!!!! even if it costs 13 000 USD!!!!!!!!!!!!!
Please add ARM support!
Cool !
You guys are doing amazing work – it says a lot that your first Android emulator is better than anything we've seen from Google. Keep it up!
Wow love it, finally it comes from Microsoft
oh my god.
it's even better than default Android emulator…
thanks microsoft…!
Amazing, thank you so much!
i love Microsoft
Thanks, you guys amazing!
Well done Microsoft.
Looks great! One question though, will all features be available to Windows 7 users too or are they exclusive to Windows 8/8.1? One problem building mobile apps in my company is the fact that a lot of the new VS features are only enabled in Win8+ installations, but my company has no plans to upgrade from Win7.
By this Microsoft is the best company of software.
Always thinking in the developers.
Magnifique !! Pourvoir développer des applis Android sous Visual Studio juste énorme !
I'm surprised at the positive comments. This doesn't run on Windows 7!
My preview version failed to install the android emulator, can I get it without reinstall everything?
@Leon, @S: The emulator is not exclusive to Xamarin projects. Currently, it integrates into Visual Studio to support debug deployment from Apache Cordova projects, Cross Platform C++ projects, and Xamarin projects. There are pictures in the above blog post showing the integration for each type.
In fact, you can launch the emulator through Visual Studio and use the running instance with any development environment (from the above blog post): "Note: If you want to use the VS Emulator for Android from a different IDE, as a temporary workaround you can always launch our emulator from Visual Studio using one of the options above, then close that project and leave the emulator running and available for your other IDE to target (over ADB). "
how/where do i download the emulator for this?
oh and Great Work 😉
@Horst: I believe that's a typo. It should be "and for Xamarin for Visual Studio 2015 Preview".
SF: The reason that a lot of items are Windows 8.0/8.1 only is because of internal changes to the operating system, especially when it comes to virtualization and Hyper-V on the desktop. The VS features rely on operating system features that are not even there in Windows 7.
I love C and C++, the metro style is look great, thanks!
I'd love if Hyper-V would run in VMware Workstation VM.
I'm running a separate VM for each of my customers to keep their requirements separate. If I could run any of the Visual Studio emulators within these VMs this would mean a great deal of improvement.
So am I expecting too much for a iOS Hyper-V emulator? (don't tell me about cadorna, but one that I can use with Xamarin) ??
Its really cool, that graphically you can send location and battery percentages, which earlier used to be only through adb command prompt.
Its Great if It can use physical web camera instead of simulated camera.
I tried installing this on Windows 8.1 with VS 2013 Ultimate and Update 4, but I get the following message: Microsoft Visual Studio is required, but it is not installed on this computer. Please install it and retry. Reboot doesn't help either. Any suggestions?
Why didn't you bought just GenyMotion instead of developing whole the stuff your self?
OK – GREAT so far 😉 – got my ToDo app running VS 2013 UD 4 (Win7 Pro SP1), but this does not have the new emulator :-((. Can it be used with Cordova in VS 2013 (if so how do I install) – or must I now install the VS 2015 preview :-O.
Also I have yet to find anything telling me how to add a 'device' so that I can download into and then run in that also – then finally deploy to an app store (as a private app until release) ??.
Sorry if these are naive questions but its a few years since my last attempt (with Eclipse) to create an Android app :-O.
Thanks
Scott Rudy – I believe this is for Visual Studio 2015 Preview only.
Hi folks, I’ll address all the comments here – if you feel that I haven’t addressed your comment, please post it again
RE: How to get it and launch it
The emulator is free with Visual Studio 2015 on any environment that supports Hyper-V (read the blog post above). You need to install Visual Studio 2015 to get it, and you need VS2015 to launch it.
RE: programming model and IDE applicability
Like I wrote in the blog post, you can launch it from VS2015 projects (Xamarin, Cordova, or C++). Once launched you can use it from any other IDE including VS2013, or from Java projects in non-VS IDEs. If you can deploy to a device, you can deploy to our emulator (modulo the limitations listed in the blog post).
RE: “Please add support for X” or “I cannot use it until you have Y’
Thank you for the feedback for a new feature request, the best way to help us prioritize the feedback we hear from all our customers is though participating in the survey that is linked in the blog post above.
RE: Any comment that has nothing to do specifically with the VS Emulator for Android
Thank you for your input, this post is about the emulator.
Thank you for all the positive comments. Please keep the feedback coming and please take the survey to help shape our next steps.
Microsoft Superb IDE~!
speechless… now people will respect VS developers like me 🙂
No Hyper-V support for Windows 7.
BOOOOOOOOOO!
Lame. HAXM requires Hyper-V be disabled, but VS Emulator Android requires Hyper-V be enabled. Poor planning, Microsoft.
Please don't buy Xamarin…2 reasons..
a) Xamarin is operating as an independent company.. and doing very good..
b) Once Microsoft buys xamarin, the open source zealots will ask it for free.. and Quality will suffer So, keep charging a premium and give us the BEST toolset.
Great!
What about multi-touch, is it supported?
Our Xamarin Android app uses Google Play Services and so your limitation that you do not include the GMS packages is a deal breaker. Please get the licensing for GMS packages ASAP. Also while we love Xamarin, C# > C++, Java, iOS, it's expensive and we'd really like it "in the box" when we purchase Visual Studio. MS should just buy Xamarin and include it in the MSDN bundle with Premium.
stackoverflow.com/…/visual-studio-2015-android-emulator-issue
This emulator isn't working with c++ projects :'(
Horray, VS Android Emulator is working after "adb connect <ip>:5555"!
But, OpenGL ES 2.0 is not working yet. Keep on waiting 🙂
Could you add support for ROM development also? With capabilities of ROM testing in the emulator. This would be brilliant for several devs.
Thanks for all the feedback so far, your suggestions are welcome and will help us prioritize our next steps especially if you submit them through the survey linked in the blog – survey closes end of November.
This could be really awesome as the Android SDK emulator is a train wreck.
It is shame we have to wait for Visual Studio 2015 to get this. I have just downloaded VS2013 Update 4, so was hoping to get this Android emulator support in that release, or in the community version.
Oh well we will just have to wait for the formal Release of 2015 to get to this.
It's interesting that Xamarin also has an Android emulator now (which is just VirtualBox + an Android x86 image).
+1 on the "limitation that you do not include the GMS packages is a deal breaker." Please include GMS packages in your emulator.
That is the reason i love Microsoft products… I am newbie android developer and this blog post help me lot to enhance my knowledge, so i can convert my theory knowledge into practical one. Thank you Microsoft !
Can I programme in VB and then port to Android?
I'm too old to learn another language!
will the emulator run in windows technical preview?
@Ravi officially we are not supporting it as of our Preview Release.
Stay tuned for updates.
@Graham, none exists that I am aware of that will allow you to develop in VB and run on Android.
I am amazed that in this day and age we are still getting pawned by buffer overflow attacks. I have recently read an article about Android vulnerabilities on Ars that describes a real-world problem. It's always some obscure research lab that has invented some implausible situation.
If you have suggestions related to the VS Android Emulator, please log them on visualstudio.uservoice.com/…/121579-visual-studio under the "VS Android Emulator" category. For example, please see: visualstudio.uservoice.com/…/6842312-support-for-android-lollipop-5-0-or-5-1
This will give you the possibility to track progress, and also give us insight into the community's interest in this idea.
Thanks!
I'll continue using WebStorm (for Cordova) and Android Studio, both of which integrate with the factory SDK emulators, until Microsoft resolves the HAXM<-/->Hyper-V conflict. Either resolve the conflict or implement this emulator without requiring Hyper-V at all.
Awesome article.Really looking forward to reI do accept as true with all the ideas you had introduced for your post. They are very convincing and will certainly work. Nonetheless, the posts are very quick for beginners. Could you please lengthen them a bit from subsequent time? Thanks for the post.
Microsoft! Please add gyro support also
@Omer — are you looking for gyroscope support in one of the project types (Cordova/C++/Xamarin) or as a simulation/feature in the Emulator? If it is the latter, the Emulator for Android does simulate the gyroscope sensor using the "Accelerometer" tab.
Hi, sorry if this is the wrong place to try get some support but I have two issues.. one stopper.. I have put them out on Stack Overflow but none of the MS guys seem to be watching..
Anyway: 1: Deploy doesn't work with VS2015. Ive worked around this by starting the Emulator and using VS2013.
2: I cant figure out how to get the network from the emulator to be visible using Fiddler .. I've already:
a) Set fiddler to allow remote computers to connect
b) Set the proxy registration address to 'my ip address' rather then 127.0.0.1 (something I read you need to do for windows phone emulator which also uses hyperv
c) Looked at the hyperv manager and though maybe something there can help but Im not familiar and am not sure if I'll break it :-S..
Some guidance of how to do this would be great .. thanks,
Brett
@Brett — for #1, I've left an answer on StackOverflow. Sorry for the delay!
For #2, let me check with our engineers and see what extra steps you'll need to do and get back to you.
Just updated to CTP6 and not found Lollipop in emulator list! Hot to get Android 5 emu?
@Nikolay – This sounds like a consequence of doing a build-to-build upgrade of Visual Studio. Because the Emulator for Android is an extension to Visual Studio, you'll need to go to Tools > Extensions & Updates, search for "Emulator for Android", uninstall the old version (likely has the postfix "Preview") and install the new one. Hope this helps!
Thanks for answer!
I tried another way to get working environment. I made a new instance of virtual machine (VMWare10), install into Win10TP 9926 and VS2015CTP6.
Ran cordova test application from VS in WinPhone8 Emu, WinUniversal Emu, iOS Simulator. But when I tried run this cordova app in VS Emulator KitKat Phone/Lollipop Phone I saw a blank screen with messages "Starting OS.."
Then I ran emulator from hyper-v shell, connected to virtual machine. It's connected and shown me android in text mode. I tried again and again without success – always android loaded in console mode.
I imported VS Android Emulator guest from my previous VS 2015 Preview installation. This image works correct.
It seems new android emulator images are not compatible with virtual hardware/software environment (no opengl, hardware acceleration, etc)
@Nikolay — We don't support running in VMWare today, but the new images might work if you disable OpenGL by going to Program Files (or Program Files x86 if you're on a 64-bit machine)Microsoft XDE10.0.0.0SKUsAndroidxdesku.xml and deleting this line: GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay". However, without OpenGL turned on you won't be able to take advantage of many of the new features.
Many thanks you!
It's working now and allow develop and test my cordova app in the perfect android emulator. 🙂
When I run newest version of VS Emulator for Android outside the Visual Studio using xde.exe with direct parameters from ProcessHacker2, everything is OK except drag and drop for APK and non-APK files. Is it because of way of executing of xde-exe (non-managed way)? When it is executed from VS drag and drop works.
@kuser — Are you running XDE.exe under elevation (as administrator)? You only need to run as admin when the Hyper-V network setup or administrator group changes. Drag and drop doesn't work when running as elevated.
I really need the feature that @Brett requested! I need to be able to somehow monitor HTTP traffic going through the emulator. This is a must-have for debugging my app's usage of my API and others' APIs. I have posted on stackoverflow about it
stackoverflow.com/…/use-proxy-in-visual-studio-emulator-for-android
Has there been any development in this area? There must be a way to monitor HTTP traffic in the VM… How do you do it internally?
Isn't there any other work around rather than opening VS and starting the Emulator. I was doing the same until my Xamarin Trial Expired, I'm xamarin Indie Subscriber so can open Xamarin Project in VS and Start the emulator so please help me if there is any other work around.
Regards, Nitesh
@Nitesh–thanks for the comment! We've heard your feedback that starting the Emulator from a project type can be painful for non-VS development. There's a UserVoice item you can upvote for this here: visualstudio.uservoice.com/…/7072954-android-emulator-available-standalone-and-not-bund
If your Xamarin trial has expired, you can also start the emulator in VS2015 from a C++ Android Native Activity project (File > New > Project > Visual C++ > Cross Platform) or an Apache Cordova App (File > New > Project > JavaScript/TypeScript > Apache Cordova Apps). Let us know if you have any other ideas on UserVoice or questions on StackOverflow using the "android-emulator" and "visual-studio-2015" tags!
I installed VS2015 with Android Emulator inside a Windows 8.1 OS running inside an Hyper-V machine..is it possibile to use emulator? I'm getting an error..
@Martin – Sorry, it's not possible to run the emulator within a Hyper-V VM. We're looking at options, but the reason it doesn't work is that the emulator is itself a Hyper-V VM, and you can't do nested virtualization in Hyper-V.
This emulator saved my day. Spent about a week setting up the environment to run Android and got stuck getting emulator to work ( tried AVD, Xamarin Android Player and a few others ). Got frustrated and lost but this solved the issue. This is way faster and integrates nicely with other IDEs. Way to go MS!
Hi!- great article, very exciting stuff !
I was wondering if it might be an idea to clarify the VM limitation as it sounds like you can't run the emulator inside a VM due to nested virtualized environments.
VMWare Player for example works (free for non-commercial use) and some other hypervisors. You do need to configure the VM to set this up.
I have been running win10 & VS2015 w emulators as a VM since October only suffering after the CTP6 install which required a repair to run the emulators from VS (could run them fine manually).
@Iris, good point! We've heard that running the emulator in VMWare nested virtualization works well, but we haven't tested it out significantly. I'll make an edit to that effect–Thanks!
I figured out how to launch the emulator without VS! This is on Win10 Insider Preview Build 10074 with Visual Studio 2015 RC and with everything ticked in the web installer.
Make a shortcut on the desktop with this target: "C:Program Files (x86)Microsoft Emulator Manager1.0emulatormgr.exe" /sku Android
That will launch the emulator manager where you can choose which Android emulator to launch 🙂 I use it with Android Studio, works a treat!
This emulator sounds fantastic! Unfortunately, its not working for me on Win10 10074 on my Surface Pro 3 ):
On startup I get a warning about Attempting to modify switch settings, followed by an error being unable to determine the host IP address. Sometimes Xde.exe crashes, otherwise the emulator is there but VS is still stuck waiting for it to start and my project is not deployed.
most (of my) APKs are compiled for ARM only 🙁
@Sam — a pretty common issue comes from not being in the Hyper-V admins group. If this is the case, you can try the steps here: blogs.msdn.com/…/creating-a-hyper-v-administrators-local-group-through-powershell.aspx and here: blogs.msdn.com/…/allowing-non-administrators-to-control-hyper-v.aspx
@sebbu — have you tried recompiling to x86 or are there certain native libraries that you use that are ARM only?
My emulator expires! What can I do? I need an emulator with camera suport…
"The pre-release Version of the Visual Studio Emulator for Android has expired. Please upgrade to a newer version"
Where can i do this?
@zontag & @wds – If you're using Visual Studio 2015 RC, you will have gotten a prompt in the Notification Hub asking you to update the emulator. This will fix the expiration issue. You can also go to visualstudiogallery.msdn.microsoft.com/99de92db-2098-423f-b814-f8d9b67a8a95 and install the update directly from there.
I just downloaded the latest version, 17/7/15, and running inside a VMWare VM, running Windows 10 build 10240 and VS2015 RC, it gets further than it did before.
The emulator starts but then sits with "OS is starting…" and never actually starts up.
Any thoughts?
In my PC, Window8.1, VS2015, HelloWorld app will not be deployed to the emulator, it is display "Emulator launched successfully." in the vs Output View, and no further output is displayed. just only the emulator lunch. it is just like this question stackoverflow.com/…/visual-studio-emulator-for-android-project-does-not-deploy.
Looks nice. Anyone know how to paste some text into the emulator?
"In my PC, Window8.1, VS2015, HelloWorld app will not be deployed to the emulator, it is display "Emulator launched successfully." in the vs Output View, and no further output is displayed. just only the emulator lunch. it is just like this question stackoverflow.com/…/visual-studio-emulator-for-android-project-does-not-deploy."
I found the solution is manual run "adb connect host:port" with command line.
@Berend – we don't support copy-paste from the host machine to the emulator… yet! If you want to see this soon, add an item on our UserVoice page visualstudio.uservoice.com
[Critical] Unable to add user to the Hyper-V Administrators group. Exit code 2220.
Why cant i run benchmarks?
I get an emulator is unable to connect to the device operation system:
Couldn't set up the UDP port.
Please help.
@masquinyo I agree with you. Same issue here. No fixes available, no guidance, no help.
Simply, the VS Emulator for Android does *not* work after update to Windows 10.
The issue with switching between Hyper-V and no Hyper-V for Genymotion & VirtualBox remains.
Yet having Hyper-V issues on Windows 10 seems to be the big problem.
Microsoft remains the king when it comes to software development tools. My one major wish for this emulator is the support for playing H.264 video.
@fukeainideren – You'll need to add yourself to the Hyper-V Admins group manually. Go to Local Users and Groups in the Control Panel, and add your username to the "Hyper-V Administrators" group. Create it if it does not exist.
@M5 Thomas–sorry about this. We're aware of some major issues with Hyper-V after the Win10 upgrade. The current best guidance is to uninstall the emulator, remove all virtual switches from Hyper-V, and reinstall. It's terrible, but we're looking at what we can do to fix this.
@fukeainideren: i have same problem, here is device emulator forum thread by me about this issue
social.msdn.microsoft.com/…/vs-emulator-for-android-doesnt-run-on-windows-10
@John Kemnetz: manually assign is impossible for non existing group
The latest version does not seem to support drag and drop package installation anymore. Is this by design?
hello.
I'm gonna buy Visual Studio 2015. i just want to know is Xamarin included to the Visual studio 2015 or i have to pay for that too?
Please answer me quickly it's urgent.
Where is the support forum for this? Great product but lumping it in with visual studio support will ensure it gets lost in the shuffle. Please setup a dedicated form for support.
@saman – Xamarin is a separate subscription
@Christian – we use StackOverflow for support. Ask a question there with the visual-studio and android-emulator tags and we'll pick it up!
i have OS: windows7 and vs android emulator not install dose not work
what to do ?
please help
I can't seem to get passed "Preparing virtual machine…".
I got no problems with launching the Mobile Emulator 10.0.10240.0.
Is it due to hardware limitations? (Windows 10 Pro 64-bit, Intel i5-4670K@ 3.4 GHz, 8GB RAM)
I tried uninstalling and installing multiple times but no luck.
@jignesh – see last bullet point under "Current limitations." We require Hyper-V, which is not available on Win7.
@Daniel – try opening Hyper-V manager, deleting all virtual switches (in the Virtual Switch Manager) and all VMs, then restart, and try to run the emulator again. This will recreate the switches and VMs, and should fix the issue. If not, feel free to post on StackOverflow and we can help further there.
This emulator is great! It feels like being 1000times faster than the original Android SDK's emulator.
Please add some SMS emulation, so we can test whether receiving/sending SMS works with our app.
Does NOT work.
"Unable to add user to the Hyper-V Administrators group. Exit code 2220.". There is no such group, I tried manually creating it but same error.
Hyper-V is working normally, I can create VMs.
Win-10 EDUCATION
Hey @alex — really sorry about that. This is a known issue in Windows 10 Education. It has Hyper-V, but it doesn't have the Hyper-V Administrators group required by the emulator. The Windows team is working on a fix.
Thanks John,
I hope there will be an update soon…
in the emulator, why the keyboard is not working?
@Charles — sorry about that. Looks like there's a bug in the latest release. If you add the EN-US keyboard layout to Windows (don't have to have it selected, just installed), that should fix it.
Hi,
Maybe I am missing something – but how do I add a new profile to the list ???.
I want to add a 7 inch tablet 1024×600 mdpi for an Amazon Fire (2015).
GrahamS — no way to create a custom profile right now, but if you'd like that option, feel free to vote it up on our UserVoice site. visualstudio.uservoice.com/…/91622-vs-emulator-for-android
I love Microsoft and i want to learn more. Thank you 🙂
Please make available for regular version of windows 10 and not just Pro/enterprise.
Works superbly. Using Windows Server 2012 R2 for Hyper-V and VMware with Hyper-V profile (or Windows Server profile plus Hyper-V profile modifications to force v1 hypervisor mode). Be sure processor virtualization engine, preferred mode is auto, check boxes for virtualize vt-x/ept/amd-v/rvi, and cpu performance counters. Server memory tweaked for lowest usage, 500-600MB, and pseudo-desktop minimal config. See cc784562, cc938581, kb2962295 (32MB for device-emulator use-only works). 15s device boot times! It's faster than the default AVD.
Custom preset is possible. First install platforms with similar device config as desired using the standalone emulator application. I did one device of each api 19+ having 2GB ram, 4 core. The trick is to first install desired api platform. Then close all emulator. Navigate to "%localappdata%MicrosoftVisualStudioEmulatorAndroidContainersLocalDevices", and note the created config files. Clear out unwanted device image from inside the vhd folder (I did this to remove devices just installed). Then edit each of the config files for devices you want to customize. I modified description, diagonal, heap.size, and ram.size. I run api 19+ with either 1GB-2GB devices with mhdpi resolution and 192MB heap. Your mileage may vary.
Okay, now keeping these config files open, navigate to "Program Files (x86)Microsoft Emulator Manager1.0SkusAndroid" and make a backup copy of configurations.xml (**very important**). After creating a backup copy, edit configurations.xml and make the same modifications to the devices customized in localappdata. If you have trouble locating them do note the "configuration[id]" identifies the device uniquely and "platform" identifies the api. Once you've made these changes re-open the emulator application. You'll get an error at the top "Unable to establish a connection to the internet. Only device profiles for acquired platforms are shown". This is due to the changed configuration.xml (you made a backup right?). You should now see the customized devices listed instead of the Microsoft-curated versions. Clicking play will install the customized device images into the vhd folder. If you want to change the customizations, repeat the modifications above, making sure to delete the existing image from the vhd folder. Voila! Albeit a messy mod, it works and I routinely switch from 1GB-2GB devices.
Oh and to get Android Studio connecting to the device running in VMware I use host only network, disable Server firewall, obtain device ip from device tools (or set static), add adb to path on host, then run "adb connect device_ip" from Android Studio. Sometimes I need to reconnect. Still it's faster if you cannot use HAXM or would like to integrate into VS-workflow. 8)
Now if it only would work it may be cool.
XDE has stopped working…
0> 13.01.2016 15:28:39 : [Informational] ===== Session Started =====
1> 13.01.2016 15:28:39 : [Informational] Emulator manager version: 1.0.60106.1
1> 13.01.2016 15:28:39 : [Informational] Emulator manager plugin version: 1.0.60106.1
1> 13.01.2016 15:28:39 : [Informational] Microsoft Windows NT 10.0.10586.0 Windows 10 Pro
1> 13.01.2016 15:28:39 : [Informational] Virtualization type: UnknownOrNotVirtual
1> 13.01.2016 15:28:39 : [Informational] Virtualization Version: alaska – 1072009
1> 13.01.2016 15:28:39 : [Informational] Virtualization Serial Number: to be filled by o.e.m.
1> 13.01.2016 15:28:39 : [Informational] Virtualization Product: 970a-ds3p
1> 13.01.2016 15:28:39 : [Informational] Display Adapter 0: Name: NVIDIA GeForce GTX 970, Version: 10.18.13.5906
2> 13.01.2016 15:28:40 : [Informational] Reinitializing installed profiles.
2> 13.01.2016 15:28:40 : [Informational] Installed profiles initialized. Devices: 2 Platforms: 1
2> 13.01.2016 15:28:40 : [Informational] Reinitializing installable profiles.
2> 13.01.2016 15:28:40 : [Informational] Installable profiles initialized. Devices: 38 Platforms: 5
3> 13.01.2016 15:28:42 : [Informational] Waiting to launch device…
3> 13.01.2016 15:28:42 : [Informational] Launching Device: 5" KitKat (4.4) XXHDPI Phone
3> 13.01.2016 15:28:42 : [Informational] Validating emulator arguments…
3> 13.01.2016 15:28:42 : [Informational] Determining if emulator is already running…
3> 13.01.2016 15:28:42 : [Informational] Preparing virtual machine…
3> 13.01.2016 15:28:43 : [Informational] Launching emulator…
3> 13.01.2016 15:29:19 : [Critical] Could not launch 'VS Emulator 5" KitKat (4.4) XXHDPI Phone' device. Exit code -532462766.
3> 13.01.2016 15:29:19 : [Critical] XDE Path: C:Program Files (x86)Microsoft XDE10.0.10240.0xde.exe
3> 13.01.2016 15:29:19 : [Critical] XDE Arguments: /sku Android /displayName "VS Emulator 5" KitKat (4.4) XXHDPI Phone" /memSize 2048 /diagonalSize 5 /video "1080×1920" /vhd "C:UsersStephanAppDataLocalMicrosoftVisualStudioEmulatorAndroidContainersLocalDevicesvhd5_KitKat_(4.4)_XXHDPI_Phoneimage.vhd" /name "VS Emulator 5-inch KitKat (4.4) XXHDPI Phone.stephan"
3> 13.01.2016 15:29:19 : [Critical] XDE Exit Code: Unknown (-532462766)
And an error box saying "Could not get Host-IP-Address…"
Tip: When installing Visual Studio 2015 or the Visual Studio Emulator for Android separately only API 19 level emulators are installed by default. There are so many more though!
Just launch the Android Emulator for Android app and you download any of the emulators supported. Currently (as of 1/15/2015) API 23 – 17 are available.
You can launch it from
– Visual Studio Tools->Visual Studio Emulator for Android
– Start menu-> Type: "Visual Studio Emulator for Android"
Hope this helps.
need for a double reading
but again from microsoft even if android is from google!!!
Can emulatormgr.exe be used with Windows Phone/Mobile SKUs? I have the Windows Phone 8.1 and Windows Mobile 10 SDKs installed and would like something similar for them as well; so I can launch emulators and test web apps without needing Visual Studio!
@KhurramAziz – emulatorcmd.exe is currently only for the Android emulator. I can pass along the suggestion to the WP emulator folks though!
@John Kemnetz ; great and thanks in advance if you do so; sometimes when running multiple emulators, you are low on RAM and it would be nice if you don’t have to launch Visual Studio for the sake of Windows Mobile / Phone emulator!
Hello,
We are starting a major project of Android and as the Software Engineer for test automation architecture I am interested in using a hyper-v server to host a number of Android emulators. We will be using MTM and Coded UI. I have not found anywhere information about support for a hyper-v server such as Windows 2015 server on an intel platform. Can this be done and can we run the emulator potentially on Azure?
Thank you,
Paul
Nice job with the emulator. For native debugging, it makes one life so much easier. However, I have one gripe. I have an application that uses OpenGL ES and on my second shader compilation, the emulator is throwing GL_OUT_OF_MEMORY exception. The application have been tested on a few different physical device and worked perfectly fine. The app is written to use a minimum of OpenGL ES 2.0 up to the maximum the device support with extensive extension checking to prevent access to functionality not exposed in the current OpenGL ES context. So I know the issue is not related to the renderer implementation. The context gets created correctly ( I force a OpenGL ES 2.0 context in this case ), but after compiling a single vertex shader, it throws the GL OOM exception when trying to compile the fragment shader next. The shaders in question are very trivial, but maybe a little macro heavy.
ARM support layer
I’ve made 3 post/comment so far in regards to OpenGL ES not behaving correctly to only have them just vanish each time around. Don’t know who moderate the comments, but that is not the way to go if one is looking to improve this useful tool. All I’m looking for is a workaround in the meantime, other than that the emulator as is stands is useless for debugging my app.
The method described in “Current limitations” to install Google Play services works only if you’re connected using adb to “Windows Phone Emulator Internal Switch”. Adb will connect automatically when the emulator loads if (1) adb’s location is in the system PATH environment variable and (2) provided your firewall rules allow the connection. You can check for the required connection before attempting install using “adb devices -l”. If you need to connect manually make sure you use the right adapter. The emulator sets up multiple network adapters and Google Play only installed when connected to the Windows Phone Switch.
Does this work with Ryzen. I can confirm it works with AMD Fx8350 🙂
What’s up, after reading this awesome paragraph i am too happy to share my experience here with mates.
Devices In The Market Have A Diverse Set Of Android Versions, Screen Sizes, And Other Hardware Properties, Making App Testing An Expensive Headache.
http://www.savebee.in/best-smartphones-under-12000-in-india/
There is certainly a great deal to know about this subject.
I love all of the points you’ve made.