Xamarin Mobile Application Development for Android(Second Edition)
上QQ阅读APP看书,第一时间看更新

Speeding up the Android emulator

The default Android emulator that comes with the Android development toolkit is quite sluggish. It is often disappointing and painful to test an application in the Android device emulators. The wiser choice for developers is to have a real Android device to test on. However, because the Android ecosystem has various form factors and device manufactures, it is practically impossible to buy each targeted device to test the app. You have to go for some cost effective solution to test your app on all targeted devices.

The following section will guide you through some of the tips to make your Android emulator faster and other alternative options available to test Android apps.

Using the x86 emulator

Android provides an x86 emulator that can speed up the development considerably due to faster start and execution times for the AVD. The x86 emulator is not a part of the base Xamarin installation, but the directions for the installation can be found on the Xamarin website as well as the Android developer website. A very specific version may be required, particularly if you are using OS X Mavericks, so we will not replicate the directions here.

Once installed, you can take advantage of the x86 emulator by the selected Intel Atom (x86) for the CPU/ABI when editing an AVD configuration.

Third-party emulator solutions

The x86 solution should work just fine on the computer with a decent memory. Apart from the native Android emulators, you can use some of the third-party tools such as the Xamarin Android Player or Genymotion.

The Xamarin Android Player

Xamarin recently announced its own Android emulator called the Xamarin Android Player. The Xamarin Player runs on Android x86 hardware accelerated virtualization and OpenGL 2.0 for fast booting and a smooth user interface. This works on both the Windows and Mac platforms. Your system requires to have an OpenGL 2.0 compatible graphics card with at least 2 GB hard disk space and at least 2 GB or RAM to install and run the Xamarin player.

The following screenshot shows the Xamarin Android Player with the player settings pane:

The Xamarin Android Player

The Xamarin player settings pane allows you to simulate some of the emulator controls, such as battery life, geo locations, volume, and power control.

Genymotion

Genymotion is yet another alternative in the race of faster Android emulators. Genymotion is based on the open source project Android VM, developed by a French company Genymobile. It also works on all major platforms, including Mac, Windows, and Linux. The basic version of Genymotion is free to download; however, the commercial version does much more than the free version. The paid version of Genymotion can simulate multitouch, camera, GPS, network quality simulation, accelerometer, and much more. This can be the best alternative replacement for Android AVD.

The following screenshot shows the Xamarin Android Player on Mac OS:

Genymotion