Android emulators can be a bit slow and when I say slow, I mean REALLY slow. This article attempts to cover a two of the most prominent issues when using an Android emulator with Xamarin. Its speed and how buggy the debugging can be. If that makes sense. :/

So you're using Xamarin to build an app and all of a sudden, one day, out of the blue, like Xamarin just decided to hate you, it get's stuck on Starting emulator... or it just takes AGES to start debugging, chances are you're running your emulator with a virtual ARM CPU, yup... Slow.

Solving the slow AVD and buggy integration between Xamarin and AVD:

Android Emulator Slow Down Internet

To solve the issues, you'll need to change your virtual device from an ARM CPU to an Intel Atom, to do this, click the icon in the toolbar that looks like a phone with a play button over it, like so:

Its actually Because of your Hard disk’s Fetching problem i.e RPM in where it cannot fetch all the needed processes on to the Ram Memory as it takes lots of Ram memory too which conflicting other priority processes. For Low-End PCs Nowadays, you won’t easily find any good emulators. Now with the rise of New Android OS (e.g. Nougat, Oreo etc.) all the Emulators need high Specs.

Slow

This will open up the Android Virtual Device Manager and within it, you should have a list of virtual devices that Xamarin can use to debug Android apps within, we're going to want to change one of these to an Intel Atom CPU, as you can see below, I've already changed one of mine so you can see the difference within the AVD.

Note: You may notice that none of my virtual devices names contain spaces, this is because there was a known issue with the virtual names containing spaces and Xamarins ability to use them to debug so this might be worth a thought if you run into this issue.

AndroidAnimations

Now you'll need to click one of the devices in the list and then click the Edit... button, this will allow you to change the device name and configuration. You should now have been presented with a new window that looks like this:

So if you wanted to change the name, now is the time to do it, just update the text within the AVD Name field.

You'll now need to choose the Intel CPU from the CPU/ABI dropdown, just click it and choose Intel Atom (x86), now you'll need to change the VM Heap to 256 and give your device more ram if required. I tend to allow 2048.

Note: When Use Host GPU is checked, you cannot also have Snapshot checked.

If you want to speed up rendering, make sure that the Use Host GPU checkbox is checked.

Now click OK and you'll be presented with another window with the heading Result of creating AVD, click OK on that too as this window is just informational.

Making sure the final bits are installed:

In order to correctly emulate an Intel Atom CPU, you'll need to install Intel HAXM, just scroll down on the page, click to download the zip, agree with the terms, wait for it to download, extract it and install leaving all the settings default.

Chances are the AVD will now work, but if you have Hyper V running, you'll need to turn that off so that the Intel Virtualisation can run correctly, simply open up CMD with administrative rights and run the following command and when it's done, reboot:

That's it, you're good to go and your Android Virtual devices should now run at least x10 faster and Xamarin should deploy apps to it with ease.

Xamarin won't launch your app?

Your app might crash on startup with the error 'android emulator shared runtime initialization error' despite the virtual device now running very quick. This can be caused by the change in CPU on the virtual device, put simply, Xamarin uses a shared mono runtime to run its apps in debug, this is installed the first time you debug a Xamarin app, however if the device CPU changes, the binaries are now incompatible.

To solve this issue, uninstall Mono Shared Runtime and Xamarin Android API support from the Apps section within Settings, then simply Clicking play within Visual Studio will re-install both of these and your app should boot up as expected without issue.

Summary.

You can speed up Android Virtual Devices by swapping from an ARM CPU to an Intel Atom CPU.

A faster AVD will allow Xamarin to make requests of it in a timely fashion solving some issues.

Intel HAXM is required to emulate an Intel Atom CPU.

Mono runtime will need to be reinstalled.


By Luke Alderton

Published at 21 Jul 2016, 10:02 AM

S60 3rd Edition Emulator

Tags: Android,Xamarin

Emulator

Android Emulator Slow Network

Comments

Android Emulator Slow Animations

Sit tight...
We're adding your comment.

Android Emulator Slow Release

There's been a problem.
Please try again later.