Android Emulator Slow

Testing on multiple mobile devices is costly, time consuming and the default Android emulator is notoriously slow. So, what should we do? That's easy - start using a properly fast Android emulator.

KoPlayer is not only the best Best Android Emulators For Low-End PC but also one of the lightest. This lightweight Android Emulator is a choice of many gamers across the globe. Like many other emulators, KOPlayer also provides game actions control using a keyboard and mouse. Android Emulator runs slowly after an update. A number of external factors can cause the Android Emulator to begin running slowly after an update. To begin troubleshooting, we recommend the following steps: If you are running Android Emulator on Windows, check to see if you have installed Windows Updates KB4013429 and KB4015217.

When developing Android applications, you have to keep in mind all the different Android OS versions and various screen sizes and resolutions. The main objective before releasing an application is to find bugs and design imperfections.

Default Android emulator

The great thing about using an emulator for development is that it gives you an opportunity to develop applications without having a real Android device. The default Android emulator comes together with the Android SDK and can be found in the 'tools' folder.

So far so good, we have our cake, but can we eat it? The answer comes about 5 minutes after we hit the 'Launch' button. Go grab a coffee. Have breakfast. Come back. Wait another 5 minutes. Maybe even more.

Finally - the emulator launches, only to show how slow it actually is.

All these performance problems stem from the fact that it emulates an ARM processor so it can run the actual code of your application. It accomplishes that by providing dynamic binary translation of the device machine code to the OS and processor architecture of your development machine.

Basically, it does a lot of mumbo-jumbo to pretend it's an ARM processor - when actually it isn't.

OK, it's slow. So what can we do about it?

  • Well, first, we can help our CPU out by delegating the rendering process to the GPU by checking 'Use Host GPU' checkbox in AVD's edit window. The screen should now look better and be more responsive. That's because the CPU is not dealing with the tedious work of doing rendering anymore. But, that's still not fast enough.
  • We can download Intel Atom (x86) images and, while we're at it, download Intel x86 Emulator Accelerator (HAXM, for Mac and Windows only). This will enable virtual machine acceleration capabilities of the Intel CPU (for more information check this link).

Now we're getting somewhere, once this baby starts up, it should run fast and smooth.

You could say that this level of speed should be sufficient. That may be true, but an issue with the Intel x86 images is that you don't get Google Apps, they only come with ARM images. This is important if you're testing an app that uses GMaps, or Google Play Services.

So, as we've seen, ARM images aren't fast enough even with hardware acceleration. And emulators don't have the Play Store. What now?

Genymotion by Genymobile

Genymotion is a new, fast Android emulator developed by the French company Genymobile. It's based on the open-source project AndroVM, and the first beta version was released back in June.

It runs on all major platforms (Mac, Windows, Linux). For now it's freely available, but there is also going to be a paid version.

According to AndroVM blog, the free version will be feature-rich, and the paid version will be intended for large companies needing a higher level of collaboration on Genymotion.

How to use it?

Genymotion relies on Oracle VirtualBox to work (version 4.1 or above). So...

  1. Download and install VirtualBox. For Windows users it's not necessary to install VirtualBox separately, because it is available from the Genymotion site, bundled with the Genymotion emulator.

  2. Go to Genymotion website and sign up. You'll receive a validation mail, so just click on the validation link to proceed.

  3. Download and install the Genymotion emulator (the current version is 1.1.0).

  4. Start Genymotion. You might need to configure path to your Android SDK location in Genymotion settings (probably if you've installed SDK in a non default location). Since this is a first start, there are no devices. Click on 'Add' and download new device. To see available devices, write your credentials in the pop-up dialog and click 'Connect'.

  5. Select the device and click 'Start'.

It starts quickly and is insanely fast! It's a little awkward to start the emulator separately, but Genymotion provides Eclipse and Android Studio integration through plugins, also available on Genymotion website. To use the plugin, you have to provide a path to Genymotion installation and Android SDK, as well.

OK, it's fast. Is that it?

Well, for me, the sheer speed of Genymotion is what got me using it in the first place. Which is kind of funny, because in the first version you couldn't even rotate the device.

But, alongside the speed bump, it also provides GPS, compass and battery control via some good-looking widgets.

Battery control widget

The GPS widget even provides GMaps for selecting mock locations, which is really nice for testing location based apps.

Device angle control and Play Store

Through the Genymotion shell it's also possible to control the device's angle (accelerometer), but it would be cool to control it using a widget, something like the Windows phone emulator does.

Genymotion devices with Google Apps also come with the Play Store preinstalled. This comes in handy if you want to test an app from the Play Store quickly.

Multiple screen sizes

Multiple screen sizes are one of Android developer's worst nightmares. There is a huge number of different screen configurations of Android devices.

Genymotion, as well as the default emulator, offers custom configuration of device's screen. In the list of available devices, select the device for which you want to change screen configuration and click on the monitor icon on the right side. Then simply select one of the predefined screen resolutions or create your own.

Be careful when choosing resolution, because you may end up with something rather strangeā€¦

Where it comes short

The main setback of Genymotion is that it only provides devices with API version 16, 17 and a preview version of Android 4.3 (API 18). If we take a look at Google Dashboard, we'll see that Gingerbread still holds about 33% of all devices (API 10).

So, for testing on that platform you still need either a default emulator or real device, which kind of defeats the purpose of Genymotion as a testing platform.

And there is no camera, which I don't miss, but could be really useful.

In the future, we can expect even more features, like taking screenshots or video screen capturing (which would be great for making demonstration videos). An accelerometer widget would be cool, and even a camera would be nice, but we can only wait and see.

Final thoughts

Well, you can never really get rid of real devices, because you'll always want to test an app on a real device before releasing it. But during development I recommend using a Genymotion emulator. Even though it doesn't cover all major Android OS versions. It's fast, stable, the GPS sensor manipulation is awesome and with the device rotation feature added to the 1.1.0 version - it's truly the way to go.

Also, deploying apps is almost instant and that can save you a lot of time when you're doing small changes to the app. But you have to watch out since the Genymotion emulator runs faster than real devices themselves, giving you a false impression of the performance of the app.

Always test on a real device!

Like this article? Sign up for our monthly newsletter and never miss any of them.

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:

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:

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.

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:

Android

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

Android Emulator Slow Play

Tags: Android,Xamarin

Comments

Android Emulator Slow Down

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

Android Emulator Slow Start

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