Steps To Configure Xamarin.Android Emulator Performance - Part Two

Introduction
 
Xamarin is a cross-platform development tool. With Xamarin, you can use C# for iOS, Android, and Universal Windows apps. And with Xamarin Forms, interface design for all three platforms can be accomplished within its XAML-based framework. 
 
To know more about Xamarin, go to Part-1>>
 
Description
 
The default Android emulator is very slow. I have brought some steps for you to increase the performance of Xamarin.Android.
 
Apple Vs Android
 
Apple iPhone simulators never show the same issue as the Android Emulator. One of the reasons for this is that it never runs a “real emulator because the CPU instruction used by the iPhone simulator is same as the one used by the host (x86). Android Emulator emulates a real ARM processor on top of an x86 processor. Due to emulating an ARM processor, the Android emulator gets very slow.
 
For Apple, it is called Apple iPhone simulators and for Android, it is called Android Emulator.
 
Steps to solve the performance problem of Android Emulator.
 
Step 1
 
Go to Android SDK Manager.
 
 
 
It opens Android SDK Manager window.
 
 
 
Step 2
 
Go To Tools > Manage AVDS....
 
 
 
Then, an  Android Virtual Device (AVD) will open.
 
 
 
Step3
 
Open the tab named "Android Virtual Devices". All my AVDs are installed on my C:\ Path. You can check the corresponding path in your system.
 
Then, select AVD name as "AVD_for_Nexus_7_2012_by_Google"  and click on "Edit" link to configure its properties.
 
 
 
Step 4
 
Delegate the rendering process to host the GPU instead of overhead your CPU by this process. Let us check "Use Host GPU" checkbox in AVD’s Edit window.The screen should now look better and be more responsive. That is because the CPU is relieved from dealing with the difficult work of doing rendering anymore. However, that is still not fast enough.
 
 
 
Step 5
 
We need to download Intel Atom (x86) system image for each Android version we need to use for testing.
 
 
Step 6
 
Then, download Intel x86 Emulator Accelerator (HAXM, for Mac and Windows only). This will enable the virtual machine acceleration
capabilities of the Intel CPU from Android SDK Manager –> Tools. Or, install it from Intel website.
 
It's already installed on my system and asking for the update available.
 
 
  
The SDK only copies the Intel HAXM executable on your machine, and it is up to you to install the executable. To install the Intel HAXM executable, search your hard drive for IntelHaxm.exe (or IntelHAXM.dmg on Mac OS X). 
 
If you make it default, it should be located at  - %Android_HOME%\sdk\extras\Intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe.
 
Intel HAXM only works in combination with one of the Intel® Atom™ processor x86 system images.
 
Step 7
 
In order to be able to install the Intel HAXM, you need to have Intel VTx enabled in your BIOS; otherwise, you will get an error like this
during installation.
 
 
 
Step 8
 
Enable the Intel VT (Virtualization Technology) using BIOS of your System.
 
 
 
Steps To enable Intel Virtual Technology in your machine BIOS
  1. Boot into BIOS.
  2. Select "Config".
  3. Select "CPU".
  4. Press enter at "Intel Virtualization Technology".
  5. Select "Disable".
  6. Press F10 and select Yes.
  7. Boot into Windows then shutdown the system.
  8. Boot into BIOS again.
  9. Select "Enable" – Intel Virtualization Technology.
After installation goes successful, edit your AVD and you can see Intel® Atom (x86) and Intel® Atom (x86_64) under CPU/ABI lists.
 
 
 
Finally, you can definitely enjoy the speed. 
 
Pros and Cons
 
You can definitely enjoy the speed using Intel x86 images. 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 do not get Google Apps which are important if you are testing an app that uses GMaps, or Google Play Services. They only come with ARM images.
 
Summary
 
In this article, we learned the following - 
  • Configure Xamarin Android Emulator Performance Using Android SDK Manager.
  • What Intel Atom (x86) system image is.
  • Pros and Cons of Intel Atom (x86) system image.
  • What Intel Hardware Acclerated Execution Manager(HAXM) and Intel Virtual Technology(VT) are.
  • Introduction to Android SDK Manager, Android Virtual Device(AVD).
  • Setting up Intel VT in your system using BIOS.


Similar Articles