Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼


Android on x86: Understanding Android Device Emulation

The changing landscape of the Android marketplace creates unique challenges and opportunities, many of which are tied to the individual hardware specifications of devices. Hardware optimization has become a consideration for mindful application development. When testing software across a variety of devices and architectures, virtual devices are the go-to tools for agile development. This article will guide you through building customizable emulators and setting up the appropriate environments for developing applications. Tips and best practices will be offered for creating and porting versatile applications and using the Android SDK's tools and platform components to their full potential.

Overview of Android Virtual Device Emulation

Android runs on a variety of form factor devices with different screen sizes, hardware capabilities, and features. A typical device has a multitude of software (Android API) and hardware capabilities like sensors, GPS, camera, SD card and multi-touch screen with specific dimensions.

The emulator is quite flexible and configurable with different software and hardware configuration options. Developers can customize the emulator using the emulator configuration called Android Virtual Device (AVD). AVD can be thought of as a set of configuration files that specify different Android software and device hardware capabilities. The Android emulator uses these AVD configurations to configure and start the appropriate Android virtual image on the emulator.

As documented on the Android website, a typical AVD configuration has:

  • A hardware profile that specifies all the device capabilities (examples: camera, sensors).
  • A System image, which will be used by the emulator for this AVD (API level to target, such as Gingerbread or Honeycomb).
  • A Data image that acts as the dedicated storage space for user's data, settings, and SD card.
  • Other options including emulator skin, the screen dimensions, and SD card size.

Developers are encouraged to target different API levels, screen sizes, and hardware capabilities (such as camera, sensors, and multi-touch devices). The AVD configuration can be used to customize the emulator as needed. Developers can create as many AVDs as desired, each one targeting a different Intel architecture–based Android device: For example, a developer can create an Intel architecture–based Gingerbread AVD with a built-in skin like WVGA800, or a custom one manually specifying the screen resolution to be used. 

The Android SDK has supported Intel architecture–based Android emulation since version r12. The SDK integrates this support into all developer tools including the eclipse ADT plugin. Figure 1 is a sample screenshot of the Android emulator for x86 running Gingerbread. The model number is highlighted and shows "Full Android on x86 Emulator."

Android on x86 Field Guide
Figure 1: Android emulator.

For detailed instructions on how to use the emulator, please refer to the Android documentation.

Which Emulator Should You Use

At the time of this writing, there are two emulator images available for Intel architecture (x86): one for Android 2.3.7 (Gingerbread), and one for Android 4.0.4 (Ice Cream Sandwich).

While there are many advantages to developing for the latest Android operating system release, many developers prefer to target Android 2.x, as a majority of Android phones in use today do not yet run Android 4.x or higher (in the US, only 1 in 5 Android phones run ICS or higher at the time of this writing). This percentage will change over time, so it is strongly suggested that you keep market conditions in mind when determining your target operating system. For more Gingerbread-specific operating system information, this article may prove useful. For Ice Cream Sandwich information, use this article.

Why Use an Emulator?

First of all, it's free. The Android SDK and its third-party add-ons cost absolutely nothing and allow developers to emulate devices that they do not own and may not have access to. This is important as not all phones acquire the latest Android OS versions via Over The Air (OTA) updates, and it may not be feasible for developers to purchase every device that is expected to support their software package(s).

  • Development and testing. Developers can use the SDK to create several Android Virtual Device (AVD) configurations for development and testing purposes. Each AVD can have varying screen dimensions, SD card sizes, or even versions of the Android SDK (which is useful for testing backward compatibility with prior Android builds).
  • Playing with a new build. The emulator allows developers to just have fun with a new build of Android and learn more about it.

Let's walk through the steps required to build and run an emulator image on an x86 build. For simplicity's sake, this article will focus on the Gingerbread emulator, though most of this content will apply to the Ice Cream Sandwich emulator as well.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.