From 1f60afc5cbec849054c1787bf3141d6d0d49e4c3 Mon Sep 17 00:00:00 2001 From: Joe Fernandez Date: Fri, 16 Mar 2012 00:53:41 -0700 Subject: docs: Emulator Hardware Acceleration docs for SDK r17 Change-Id: I0714891d14db598f6c4acd29773975bd7754a912 --- docs/html/guide/developing/devices/emulator.jd | 1507 ++++++++++-------------- docs/html/guide/developing/tools/emulator.jd | 455 +++---- docs/html/images/emulator-wvga800l.png | Bin 513676 -> 97756 bytes 3 files changed, 884 insertions(+), 1078 deletions(-) diff --git a/docs/html/guide/developing/devices/emulator.jd b/docs/html/guide/developing/devices/emulator.jd index c217790e19cf..5edd1f5ed0f0 100644 --- a/docs/html/guide/developing/devices/emulator.jd +++ b/docs/html/guide/developing/devices/emulator.jd @@ -9,28 +9,58 @@ parent.link=index.html

In this document

  1. Overview
  2. +
  3. Android Virtual Devices and the Emulator
  4. Starting and Stopping the Emulator
  5. -
  6. Android Virtual Devices and the Emulator
  7. -
  8. Controlling the Emulator
  9. -
  10. Emulator Startup Options
  11. +
  12. Installing Applications on the Emulator
  13. +
  14. Using Hardware Acceleration +
      +
    1. Configuring Graphics Acceleration
    2. +
    3. Configuring Virtual Machine Acceleration
    4. +
    +
  15. +
  16. SD Card Emulation +
      +
    1. Creating an SD card image
    2. +
    3. Copying files to an SD card image
    4. +
    5. Loading an SD card image
    6. +
    +
  17. Working with Emulator Disk Images
      -
    1. Default Images
    2. -
    3. Runtime Images: User Data and SD Card
    4. -
    5. Temporary Images
    6. +
    7. Default image files
    8. +
    9. Runtime images: user data and SD card
    10. +
    11. Temporary images
  18. Emulator Networking
    1. Network Address Space
    2. Local Networking Limitations
    3. -
    4. Using Network Redirections
    5. +
    6. Using Network Redirection
    7. Configuring the Emulator's DNS Settings
    8. Using the Emulator with a Proxy
    9. Interconnecting Emulator Instances
    10. Sending a Voice Call or SMS to Another Emulator Instance
  19. +
  20. Using the Emulator Console +
      +
    1. Port Redirection
    2. +
    3. Geo Location Provider Emulation
    4. +
    5. Hardware Events Emulation
    6. +
    7. Device Power Characteristics
    8. +
    9. Network Status
    10. +
    11. Network Delay Emulation
    12. +
    13. Network Speed Emulation
    14. +
    15. Telephony Emulation
    16. +
    17. SMS Emulation
    18. +
    19. VM State
    20. +
    21. Emulator Window
    22. +
    23. Terminating an Emulator Instance
    24. +
    +
  21. +
  22. Emulator Limitations
  23. +
  24. Troubleshooting Emulator Problems

See also

@@ -44,7 +74,7 @@ parent.link=index.html Image of the Android Emulator

The Android SDK includes a virtual mobile device emulator -that runs on your computer. The emulator lets you prototype, develop, and test +that runs on your computer. The emulator lets you prototype, develop and test Android applications without using a physical device.

The Android emulator mimics all of the hardware and software features @@ -52,7 +82,7 @@ of a typical mobile device, except that it cannot place actual phone calls. It provides a variety of navigation and control keys, which you can "press" using your mouse or keyboard to generate events for your application. It also provides a screen in which your application is displayed, together with any other -Android applications running.

+active Android applications.

To let you model and test your application more easily, the emulator utilizes Android Virtual Device (AVD) configurations. AVDs let you define certain hardware @@ -62,16 +92,16 @@ the emulator, it can use the services of the Android platform to invoke other applications, access the network, play audio and video, store and retrieve data, notify the user, and render graphical transitions and themes.

-

The emulator also includes a variety of debug capabilities, such as a console -from which you can log kernel output, simulate application interrupts (such as -arriving SMS messages or phone calls), and simulate latency effects and dropouts -on the data channel.

+

The emulator also includes a variety of debug capabilities, such as a console +from which you can log kernel output, simulate application interrupts (such as +arriving SMS messages or phone calls), and simulate latency effects and dropouts +on the data network.

-

Overview

+

Overview

-

The Android emulator is a QEMU-based application that provides a virtual ARM +

The Android emulator is an application that provides a virtual mobile device on which you can run your Android applications. It runs a full Android system stack, down to the kernel level, that includes a set of preinstalled applications (such as the dialer) that you can access from your @@ -81,16 +111,15 @@ mobile device skin and key mappings. When launching the emulator and at runtime, you can use a variety of commands and options to control its behavior.

-

The Android system image distributed in the SDK contains ARM machine code for -the Android Linux kernel, the native libraries, the Dalvik VM, and the various -Android package files (such as for for the Android framework and preinstalled -applications). The emulator's QEMU layers provide dynamic binary translation of -the ARM machine code to the OS and processor architecture of your development -machine.

+

The Android system images available through the Android SDK Manager contain +code for the Android Linux kernel, the native libraries, the Dalvik VM, and the +various Android packages (such as the Android framework and preinstalled +applications). The emulator provides dynamic binary translation of device +machine code to the OS and processor architecture of your development +machine.

-

Adding custom capabilities to the underlying QEMU services, the Android -emulator supports many hardware features likely to be found on mobile devices, -including:

+

The Android emulator supports many hardware features likely to be found on +mobile devices, including:

-

The sections below provide more information about the emulator and how to use -it for developing Android applications.

- +

The following sections describe the emulator and its use for development of Android +applications in more detail.

- -

Android Virtual Devices and the Emulator

+

Android Virtual Devices and the Emulator

To use the emulator, you first must create one or more AVD configurations. In each configuration, you specify an Android platform to run in the emulator and the set of hardware options and emulator skin you want to use. Then, when you launch the emulator, you specify the AVD configuration that you want to load.

-

To specify the AVD you want to load when starting the emulator, you use the --avd argument, as shown in the previous section.

-

Each AVD functions as an independent device, with its own private storage for user data, SD card, and so on. When you launch the emulator with an AVD configuration, it automatically loads the user data and SD card data from the AVD directory. By default, the emulator stores the user data, SD card data, and cache in the AVD directory.

To create and manage AVDs you use the AVD Manager UI or the android tool -that is included in the SDK. +that is included in the SDK. For complete information about how to set up AVDs, see Managing Virtual Devices.

- -

Starting and Stopping the Emulator

+

Starting and Stopping the Emulator

During development and testing of your application, you install and run your application in the Android emulator. You can launch the emulator as a standalone -application, from a command line, or you can use it as part of your Eclipse +application from a command line, or you can run it from within your Eclipse development environment. In either case, you specify the AVD configuration to load and any startup options you want to use, as described in this document.

@@ -144,20 +169,24 @@ load and any startup options you want to use, as described in this document. depending on your needs, you can start multiple emulator instances and run your application in more than one emulated device. You can use the emulator's built-in commands to simulate GSM phone calling or SMS between emulator -instances, and you can set up network redirections that allow emulators to send +instances, and you can set up network redirection that allows emulators to send data to one another. For more information, see Telephony Emulation, SMS Emulation, and Emulator Networking

-

To start an instance of the emulator from the command line, change to the +

To start an instance of the emulator from the command line, navigate to the tools/ folder of the SDK. Enter emulator command like this:

-
emulator -avd <avd_name>
+
emulator -avd <avd_name> [<options>]
+ +

This initializes the emulator, loads an AVD configuration and displays the emulator +window. For more information about command line options for the emulator, see the +Android Emulator tool reference.

-

This initializes the emulator and loads an AVD configuration (see the next -section for more information about AVDs). You will see the emulator window -appear on your screen.

+

Note: You can run multiple +instances of the emulator concurrently, each with its own AVD configuration and +storage area for user data, SD card, and so on.

If you are working in Eclipse, the ADT plugin for Eclipse installs your application and starts the emulator automatically, when you run or debug @@ -171,585 +200,435 @@ on the Emulator for information about how to install your application.

To stop an emulator instance, just close the emulator's window.

For a reference of the emulator's startup commands and keyboard mapping, see -the Android Emulator document.

+the Android Emulator tool +reference.

+ + +

Installing Applications on the Emulator

+ +

If you don't have access to Eclipse or the ADT Plugin, you can install your application on the +emulator using the adb utility. Before +installing the application, you need to build and package it into an .apk as described +in Building and +Running Apps. Once the application is installed, you can start the emulator from the command +line as described previously, using any startup options necessary. +When the emulator is running, you can also connect to the emulator instance's +console to issue commands as needed.

+ +

As you update your code, you periodically package and install it on the emulator. +The emulator preserves the application and its state data across restarts, +in a user-data disk partition. To ensure that the application runs properly +as you update it, you may need to delete the emulator's user-data partition. +To do so, start the emulator with the -wipe-data option. +For more information about the user-data partition and other emulator storage, +see Working with Emulator Disk Images.

+

Using Hardware Acceleration

+

In order to make the Android emulator run faster and be more responsive, you can configure it to +take advantage of hardware acceleration, using a combination of configuration options, specific +Android system images and hardware drivers.

- +

Configuring Graphics Acceleration

+

Caution: As of SDK Tools Revision 17, the graphics +acceleration feature for the emulator is experimental; be alert for incompatibilities and +errors when using this feature.

-

Controlling the Emulator

+

Graphics acceleration for the emulator takes advantage of your development computer's graphics +hardware, specifically its graphics processing unit (GPU), to make screen drawing faster. To use +the graphics acceleration feature, you must have the following versions of the Android development +tools installed:

-

You can use emulator startup options and console commands to control the behaviors and -characteristics of the emulated environment itself. -

+ -

When the emulator is running, you can interact with the emulated mobile -device just as you would an actual mobile device, except that you use your mouse -pointer to "touch" the touchscreen and your keyboard keys to -"press" the simulated device keys.

+

Use the Android SDK +Manager to install these components:

-

The table below summarizes the mappings between the emulator keys and and -the keys of your keyboard.

+

Note: Not all applications are compatible with graphics hardware +acceleration. In particular, the Browser application and applications using the {@link +android.webkit.WebView} component are not compatible with graphics acceleration.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

To configure an AVD to use graphics acceleration:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Emulated Device Key Keyboard Key
HomeHOME
Menu (left softkey)F2 or Page-up button
Star (right softkey)Shift-F2 or Page Down
BackESC
Call/dial button F3
Hangup/end call buttonF4
SearchF5
Power buttonF7
Audio volume up buttonKEYPAD_PLUS, Ctrl-5
Audio volume down buttonKEYPAD_MINUS, Ctrl-F6
Camera buttonCtrl-KEYPAD_5, Ctrl-F3
Switch to previous layout orientation (for example, portrait, landscape)KEYPAD_7, Ctrl-F11
Switch to next layout orientation (for example, portrait, landscape)KEYPAD_9, Ctrl-F12
Toggle cell networking on/offF8
Toggle code profilingF9 (only with -trace startup option)
Toggle fullscreen modeAlt-Enter
Toggle trackball modeF6
Enter trackball mode temporarily (while key is pressed)Delete
DPad left/up/right/downKEYPAD_4/8/6/2
DPad center clickKEYPAD_5
Onion alpha increase/decreaseKEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)
+
    +
  1. Make sure you have the required SDK components installed (listed above).
  2. +
  3. Start the AVD Manager and create a new AVD with the Target value of +Android 4.0.3 (API Level 15), revision 3 or higher.
  4. +
  5. If you want to have graphics acceleration enabled by default for this AVD, in the +Hardware section, click New, select GPU emulation +and set the value to Yes. +

    Note: You can also enable graphics acceleration when you +start an emulator using command line options as describe in the next section.

    +
  6. +
  7. Name the AVD instance and select any other configuration options. +

    Caution: Do not select the Snapshot: Enabled +option. Snapshots are not supported for emulators with graphics acceleration enabled.

    +
  8. +
  9. Click Create AVD to save the emulator configuration.
  10. +
-

Note that, to use keypad keys, you must first disable NumLock on your development computer.

+

If you set GPU emulation to Yes for your AVD, then graphics +acceleration is automatically enabled when you run it. If you did not enable GPU +emulation when you created the AVD, you can still enable it at runtime.

-

Emulator Startup Options

+

To enable graphics acceleration at runtime for an AVD:

-

The emulator supports a variety of options that you can specify -when launching the emulator, to control its appearance or behavior. -Here's the command-line usage for launching the emulator with options:

+ -
emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]
-

The table below summarizes the available options.

+

Configuring Virtual Machine Acceleration

- - - - - - - +

Caution: As of SDK Tools Revision 17, the virtual machine +acceleration feature for the emulator is experimental; be alert for incompatibilities and errors +when using this feature.

+ +

Many modern CPUs provide extensions for running virtual machines (VMs) more efficiently. Taking +advantage of these extensions with the Android emulator requires some additional configuration of +your development system, but can significantly improve the execution speed. Before attempting to use +this type of acceleration, you should first determine if your development system’s CPU supports one +of the following virtualization extensions technologies:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
  • Intel Virtualization Technology (VT, VT-x, vmx) extensions
  • +
  • AMD Virtualization (AMD-V, SVM) extensions (only supported for Linux)
  • + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    CategoryOptionDescriptionComments
    Help-helpPrint a list of all emulator options. 
    -help-allPrint help for all startup options. 
    -help-<option>Print help for a specific startup option. 
    -help-debug-tagsPrint a list of all tags for -debug <tags>. 
    -help-disk-imagesPrint help for using emulator disk images. 
    -help-environmentPrint help for emulator environment variables. 
    -help-keysPrint the current mapping of keys. 
    -help-keyset-filePrint help for defining a custom key mappings file. 
    -help-virtual-devicePrint help for Android Virtual Device usage. 
    AVD-avd <avd_name> or
    - @<avd_name>
    Required. Specifies the AVD to load for this emulator - instance.You must create an AVD configuration before launching the emulator. For - information, see Managing - Virtual Devices with AVD Manager.
    Disk Images-cache <filepath>Use <filepath> as the working cache partition image. Optionally, you can specify a path relative to the current working directory. - If no cache file is specified, the emulator's default behavior is to use a temporary file instead. -

    For more information on disk images, use -help-disk-images.

    -
    -data <filepath>Use <filepath> as the working user-data disk image. Optionally, you can specify a path relative to the current working directory. - If -data is not used, the emulator looks for a file named "userdata-qemu.img" - in the storage area of the AVD being used (see -avd). -
    -initdata <filepath>When resetting the user-data image (through -wipe-data), copy the contents - of this file to the new user-data disk image. By default, the emulator copies the <system>/userdata.img.Optionally, you can specify a path relative to the current working directory. See also -wipe-data. -

    For more information on disk images, use -help-disk-images.

    -nocacheStart the emulator without a cache partition.See also -cache <file>.
    -ramdisk <filepath>Use <filepath> as the ramdisk image.Default value is <system>/ramdisk.img. -

    Optionally, you can specify a path relative to the current working directory. - For more information on disk images, use -help-disk-images.

    -
    -sdcard <filepath>Use <file> as the SD card image.Default value is <system>/sdcard.img. -

    Optionally, you can specify a path relative to the current working directory. For more information on disk images, use -help-disk-images.

    -
    -wipe-dataReset the current user-data disk image (that is, the file specified by -datadir and - -data, or the default file). The emulator deletes all data from the user data image file, - then copies the contents of the file at -inidata data to the image file before starting. - See also -initdata. -

    For more information on disk images, use -help-disk-images.

    -
    Debug-debug <tags>Enable/disable debug messages for the specified debug tags.<tags> is a space/comma/column-separated list of debug component names. - Use -help-debug-tags to print a list of debug component names that you can use.
    -debug-<tag>Enable/disable debug messages for the specified debug tag.Use -help-debug-tags to print a list of debug component names that you can use in <tag>.
    -debug-no-<tag>Disable debug messages for the specified debug tag.
    -logcat <logtags>Enable logcat output with given tags.If the environment variable ANDROID_LOG_TAGS is defined and not - empty, its value will be used to enable logcat output by default.
    -shellCreate a root shell console on the current terminal.You can use this command even if the adb daemon in the emulated system is broken. - Pressing Ctrl-c from the shell stops the emulator instead of the shell.
    -shell-serial <device>Enable the root shell (as in -shell and specify the QEMU character - device to use for communication with the shell.<device> must be a QEMU device type. See the documentation for '-serial dev' at - http://wiki.qemu.org/download/qemu-doc.html - for a list of device types. - -

    Here are some examples:

      -
    • -shell-serial stdio is identical to -shell
    • -
    • -shell-serial tcp::4444,server,nowait lets you communicate with the shell over TCP port 4444
    • -
    • -shell-serial fdpair:3:6 lets a parent process communicate with the shell using fds 3 (in) and 6 (out)
    • -
    • -shell-serial fdpair:0:1 uses the normal stdin and stdout fds, except that QEMU won't tty-cook the data.
    • -
    -
    -show-kernel <name>Display kernel messages. 
    -trace <name>Enable code profiling (press F9 to start), written to a specified file. 
    -verboseEnable verbose output.Equivalent to -debug-init. -

    You can define the default verbose output options used by emulator instances in the Android environment variable -ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option: --debug-<tags>.

    -

    Here's an example showing ANDROID_VERBOSE defined with the -debug-init and -debug-modem options: -

    ANDROID_VERBOSE=init,modem

    -

    For more information about debug tags, use <-help-debug-tags>.

    -
    Media-audio <backend>Use the specified audio backend. 
    -audio-in <backend>Use the specified audio-input backend. 
    -audio-out <backend>Use the specified audio-output backend. 
    -noaudioDisable audio support in the current emulator instance. 
    -radio <device>Redirect radio modem interface to a host character device. 
    -useaudioEnable audio support in the current emulator instance.Enabled by default.
    Network-dns-server <servers>Use the specified DNS server(s). The value of <servers> must be a comma-separated list of up to 4 DNS server names or - IP addresses.
    -http-proxy <proxy>Make all TCP connections through a specified HTTP/HTTPS proxyThe value of <proxy> can be one of the following:
    - http://<server>:<port>
    - http://<username>:<password>@<server>:<port> -

    The http:// prefix can be omitted. If the -http-proxy <proxy> command is not supplied, - the emulator looks up the http_proxy environment variable and automatically uses any value matching - the <proxy> format described above.

    -netdelay <delay>Set network latency emulation to <delay>.Default value is none. See the table in Network Delay Emulation for - supported <delay> values.
    -netfastShortcut for -netspeed full -netdelay none 
    -netspeed <speed>Set network speed emulation to <speed>.Default value is full. See the table in Network Speed Emulation for - supported <speed> values.
    -port <port>Set the console port number for this emulator instance to <port>.The console port number must be an even integer between 5554 and 5584, inclusive. <port>+1 - must also be free and will be reserved for ADB.
    -report-console <socket>Report the assigned console port for this emulator instance to a remote third party - before starting the emulation. <socket> must use one of these formats: +

    The specifications from the manufacturer of your CPU should indicate if it supports +virtualization extensions. If your CPU does not support one of these virtualization technologies, +then you cannot use virtual machine acceleration.

    -

    tcp:<port>[,server][,max=<seconds>]
    -unix:<port>[,server][,max=<seconds>]

    +

    Note: Virtualization extensions are typically enabled through +your computer's BIOS and are frequently turned off by default. Check the documentation for your +system's motherboard to find out how to enable virtualization extensions.

    -

    Use -help-report-console

    to view more information about this topic.
    System-cpu-delay <delay>Slow down emulated CPU speed by <delay> Supported values for <delay> are integers between 0 and 1000. - -

    Note that the <delay> does not correlate to clock speed or other absolute metrics -— it simply represents an abstract, relative delay factor applied non-deterministically -in the emulator. Effective performance does not always -scale in direct relationship with <delay> values.

    -
    -gps <device>Redirect NMEA GPS to character device.Use this command to emulate an NMEA-compatible GPS unit connected to - an external character device or socket. The format of <device> must be QEMU-specific - serial device specification. See the documentation for 'serial -dev' at - http://wiki.qemu.org/download/qemu-doc.html. -
    -nojniDisable JNI checks in the Dalvik runtime. 
    -qemuPass arguments to qemu. 
    -qemu -hDisplay qemu help.
    -radio <device>Redirect radio mode to the specified character device.The format of <device> must be QEMU-specific - serial device specification. See the documentation for 'serial -dev' at -http://wiki.qemu.org/download/qemu-doc.html. -
    -timezone <timezone>Set the timezone for the emulated device to <timezone>, instead of the host's timezone.<timezone> must be specified in zoneinfo format. For example: -

    "America/Los_Angeles"
    -"Europe/Paris"

    -
    -versionDisplay the emulator's version number. 
    UI-dpi-device <dpi>Scale the resolution of the emulator to match the screen size - of a physical device.The default value is 165. See also -scale.
    -no-boot-animDisable the boot animation during emulator startup.Disabling the boot animation can speed the startup time for the emulator.
    -no-windowDisable the emulator's graphical window display. 
    -scale <scale>Scale the emulator window. <scale> is a number between 0.1 and 3 that represents the desired scaling factor. You can - also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto" - tells the emulator to select the best window size.
    -raw-keysDisable Unicode keyboard reverse-mapping. 
    -noskinDon't use any emulator skin. 
    -keyset <file>Use the specified keyset file instead of the default.The keyset file defines the list of key bindings between the emulator and the host keyboard. - For more information, use -help-keyset to print information about this topic. -
    -onion <image>Use overlay image over screen.No support for JPEG. Only PNG is supported.
    -onion-alpha <percent>Specify onion skin translucency value (as percent). - Default is 50.
    -onion-rotation <position>Specify onion skin rotation. - <position> must be one of the values 0, 1, 2, 3.
    -skin <skinID>This emulator option is deprecated. Please set skin options using AVDs, rather than by using this emulator -option. Using this option may yield unexpected and in some cases misleading -results, since the density with which to render the skin may not be defined. -AVDs let you associate each skin with a default density and override the default -as needed. For more information, see Managing Virtual Devices -with AVD Manager. -
    -skindir <dir>This emulator option is deprecated. See comments for -skin, above.
    +

    Once you have determined that your CPU supports virtualization extensions, make sure you can work +within these additional requirements of running an emulator inside an accelerated virtual +machine:

    + + + +

    To use virtual machine acceleration with the emulator, you need the following version of Android +development tools. Use the Android SDK +Manager to install these components:

    + + + +

    If your development environment meets all of the requirements for running a VM-accelerated +emulator, you can use the AVD Manager to create an x86-based AVD configuration:

    + +
      +
    1. In the Android SDK Manager, make sure you have an x86-based System Image + installed for your target Android version. If you do not have an x86 System + Image installed, select one in the Android SDK Manager and install it. +

      Tip: System images are listed under each API Level in the SDK + Manager. An x86 system image may not be available for all API levels.

      +
    2. +
    3. Start the AVD Manager and create a new AVD with an x86 value for the +CPU/ABI field. You may need to select a specific Target value, or +select a Target value and then select a specific CPU/ABI +option.
    4. +
    5. Name the emulator instance and select any other configuration options.
    6. +
    7. Click Create AVD to save the emulator configuration.
    8. +
    + +

    Configuring VM Acceleration on Windows

    + +

    Virtual machine acceleration for Windows requires the installation of the Intel Hardware +Accelerated Execution Manager (Intel HAXM). The software requires an Intel CPU with +Virtualization Technology (VT) support and one of the following operating systems:

    + + + +

    To install the virtualization driver:

    + +
      +
    1. Start the Android SDK Manager, select Extras and then select Intel +Hardware Accelerated Execution Manager.
    2. +
    3. After the download completes, execute {@code +<sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe}.
    4. +
    5. Follow the on-screen instructions to complete installation.
    6. +
    7. After installation completes, confirm that the virtualization driver is operating correctly by +opening a command prompt window and running the following command: +
      sc query intelhaxm
      +

      You should see a status message including the following information:

      +
      +SERVICE_NAME: intelhaxm
      +       ...
      +       STATE              : 4  RUNNING
      +       ...
      +
      +
    8. +
    + +

    To run an x86-based emulator with VM acceleration:

    + + +

    You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running +its installer.

    + +

    You can stop using the virtualization driver by uninstalling it. Re-run the installer or use +the Control Panel to remove the software.

    + + +

    Configuring VM Acceleration on Mac

    + +

    Virtual machine acceleration on a Mac requires the installation of the Intel Hardware Accelerated +Execution Manager (Intel HAXM) kernel extension to allow the Android emulator to make use of CPU +virtualization extensions. The kernel extension is compatible with Mac OS X Snow Leopard (version +10.6.0) and higher.

    + +

    To install the Intel HAXM kernel extension:

    + +
      +
    1. Start the Android SDK Manager, select Extras and then select Intel +Hardware Accelerated Execution Manager. +
    2. After the download completes, execute + {@code <sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg}.
    3. +
    4. Double click the IntelHAXM.mpkg icon to begin installation.
    5. +
    6. Follow the on-screen instructions to complete installation.
    7. +
    8. After installation completes, confirm that the new kernel extension is operating correctly by +opening a terminal window and running the following command: +
      kextstat | grep intel
      +

      You should see a status message containing the following extension name, indicating that the + kernel extension is loaded:

      +
      com.intel.kext.intelhaxm
      +
    9. +
    + +

    To run an x86-based emulator with VM acceleration:

    + + +

    You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running +the installer.

    + +

    You can stop using the virtualization kernel driver by uninstalling it. Before removing it, shut +down any running x86 emulators. To unload the virtualization kernel driver, run the following +command in a terminal window:

    + +
    sudo /System/Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh
    + +

    Configuring VM Acceleration on Linux

    + +

    Linux-based systems support virtual machine acceleration through the KVM software package. Follow +instructions for installing KVM on your +Linux system, and verify that KVM is enabled. In addition to following the installation +instructions, be aware of these configuration requirements:

    + + + +

    To run an x86-based emulator with VM acceleration:

    + + + +

    Important: When using the {@code -qemu} command line option, make sure +it is the last parameter in your command. All subsequent options are interpreted as qemu-specific +parameters.

    + + +

    SD Card Emulation

    + +

    You can create a disk image and then load it to the emulator at startup, to +simulate the presence of a user's SD card in the device. To do this, you can specify +an SD card image when you create an AVD, or you can use the mksdcard utility included +in the SDK.

    + +

    The following sections describe how to create an SD card disk image, how to copy +files to it, and how to load it in the emulator at startup.

    + +

    Note that you can only load a disk image at emulator startup. Similarly, you +can not remove a simulated SD card from a running emulator. However, you can +browse, send files to, and copy/remove files from a simulated SD card either +with adb or the emulator.

    + +

    The emulator supports emulated SDHC cards, so you can create an SD card image +of any size up to 128 gigabytes.

    + + +

    Creating an SD card image

    + +

    There are several ways of creating an SD card image. The easiest way is to use the +AVD Manager to create a new SD card by specifying a size when you create an AVD. +You can also use the {@code android} command line tool when creating an AVD. Just add the +-c option to your command:

    + +
    android create avd -n <avd_name> -t <targetID> -c <size>[K|M]
    + +

    The -c option can also be used to to specify a path to an SD card +image for the new AVD. For more information, see Managing Virtual Devices +from the Command Line. +

    + +

    You can also use the mksdcard tool, included in the SDK, to create a FAT32 disk +image that you can load in the emulator at startup. You can access mksdcard in +the tools/ directory of the SDK and create a disk image like this:

    + +
    mksdcard <size> <file>
    + +

    For example:

    + +
    mksdcard 1024M sdcard1.iso
    + +

    For more information, see mksdcard.

    + + +

    Copying files to an SD card image

    + +

    Once you have created the disk image, you can copy files to it prior to +loading it in the emulator. To copy files, you can mount the image as a loop +device and then copy the files to it, or you can use a utility such as {@code mtools} to +copy the files directly to the image. The {@code mtools} package is available for Linux, +Mac, and Windows.

    + +

    Alternatively, you can use the {@code adb push} command to move files onto an SD card image +while it is loaded in an emulator. For more information see the {@code adb push} documentation.

    + +

    Loading an SD card image

    +

    By default, the emulator loads the SD card image that is stored with the active +AVD (see the -avd startup option).

    + +

    Alternatively, you can start the emulator with the +-sdcard flag and specify the name and path of your image (relative +to the current working directory):

    + +
    emulator -sdcard <filepath>
    - -

    Working with Emulator Disk Images

    +

    Working with Emulator Disk Images

    The emulator uses mountable disk images stored on your development machine to -simulate flash (or similar) partitions on an actual device. For example, it uses +simulate flash (or similar) partitions on an actual device. For example, it uses a disk image containing an emulator-specific kernel, the Android system, a ramdisk image, and writeable images for user data and simulated SD card.

    To run properly, the emulator requires access to a specific set of disk image -files. By default, the Emulator always looks for the disk images in the -private storage area of the AVD in use. If no images exist there when -the Emulator is launched, it creates the images in the AVD directory based on +files. By default, the Emulator always looks for the disk images in the +private storage area of the AVD in use. If no images exist there when +the Emulator is launched, it creates the images in the AVD directory based on default versions stored in the SDK.

    -

    Note: The default storage location for -AVDs is in ~/.android/avd on OS X and Linux, C:\Documents and -Settings\<user>\.android\ on Windows XP, and +

    Note: The default storage location for +AVDs is in ~/.android/avd on OS X and Linux, C:\Documents and +Settings\<user>\.android\ on Windows XP, and C:\Users\<user>\.android\ on Windows Vista.

    To let you use alternate or custom versions of the image files, the emulator provides startup options that override the default locations and filenames of -the image files. When you use the options, the emulator searches for the image +the image files. When you use one of these options, the emulator searches for the image file under the image name or location that you specify; if it can not locate the image, it reverts to using the default names and location.

    @@ -757,20 +636,19 @@ image, it reverts to using the default names and location.

    image files, and temporary image files. The sections below describe how to override the location/name of each type of file.

    - -

    Default Images

    +

    Default image files

    -

    When the emulator launches but does not find an existing user data image in +

    When the emulator launches, but does not find an existing user data image in the active AVD's storage area, it creates a new one from a default version -included in the SDK. The default user data image is read-only. The image +included in the SDK. The default user data image is read-only. The image files are read-only.

    The emulator provides the -system <dir> startup option to -let you override the location under which the emulator looks for the default +let you override the location where the emulator looks for the default user data image.

    The emulator also provides a startup option that lets you override the name -of the default user data image, as described in the table below. When you use the +of the default user data image, as described in the following table. When you use the option, the emulator looks in the default directory, or in a custom location (if you specified -system <dir>).

    @@ -810,25 +688,24 @@ option, the emulator looks in the default directory, or in a custom location - -

    Runtime Images: User Data and SD Card

    +

    Runtime images: user data and SD card

    -

    At runtime, the emulator reads and writes data on two disk images: a -user-data image and (optionally) an SD card image. This emulates the user-data +

    At runtime, the emulator reads and writes data to two disk images: a +user-data image and (optionally) an SD card image. These images emulate the user-data partition and removable storage media on actual device.

    -

    The emulator provides a default user-data disk image. At startup, the emulator -creates the default image as a copy of the system user-data image (user-data.img), +

    The emulator provides a default user-data disk image. At startup, the emulator +creates the default image as a copy of the system user-data image (user-data.img), described above. The emulator stores the new image with the files of the active AVD.

    -

    The emulator provides startup options to let you override the actual names and storage -locations of the runtime images to load, as described in the table below. When you use one +

    The emulator provides startup options to let you override the actual names and storage +locations of the runtime images to load, as described in the following table. When you use one of these options, the emulator looks for the specified file(s) in the current working directory, in the AVD directory, or in a custom location (if you specified a path with the filename).

    @@ -842,7 +719,7 @@ in the AVD directory, or in a custom location (if you specified a path with the userdata-qemu.img An image to which the emulator writes runtime user-data for a unique user. Override using -data <filepath>, where <filepath> is the -path the image, relative to the current working directory. If you supply a filename only, +path the image, relative to the current working directory. If you supply a filename only, the emulator looks for the file in the current working directory. If the file at <filepath> does not exist, the emulator creates an image from the default userdata.img, stores it under the name you specified, and persists user data to it at shutdown. @@ -852,7 +729,7 @@ specified, and persists user data to it at shutdown. sdcard.img An image representing an SD card inserted into the emulated device. Override using -sdcard <filepath>, where <filepath> is the -path the image, relative to the current working directory. If you supply a filename only, +path the image, relative to the current working directory. If you supply a filename only, the emulator looks for the file in the current working directory. @@ -864,38 +741,38 @@ the emulator looks for the file in the current working directory. session-specific data. For example, it uses the image to store a unique user's installed application data, settings, databases, and files.

    -

    At startup, the emulator attempts to load a user-data image stored during -a previous session. It looks for the file in the current working directory, -in the AVD directory as described above, and at the custom location/name +

    At startup, the emulator attempts to load a user-data image stored during +a previous session. It looks for the file in the current working directory, +in the AVD directory described in a previous section and at the custom location/name that you specified at startup.

    Note: Because of the AVD configurations used in the emulator, -each emulator instance now gets its own dedicated storage. There is no need +each emulator instance gets its own dedicated storage. There is no longer a need to use the -d option to specify an instance-specific storage area.

    SD Card

    Optionally, you can create a writeable disk image that the emulator can use -to simulate removeable storage in an actual device. For information about how to create an +to simulate removeable storage in an actual device. For information about how to create an emulated SD card and load it in the emulator, see SD Card Emulation

    You can also use the android tool to automatically create an SD Card image -for you, when creating an AVD. For more information, see Managing Virtual Devices with AVD Manager. - -

    Temporary Images

    + +

    Temporary Images

    The emulator creates two writeable images at startup that it deletes at device power-off. The images are:

    @@ -909,8 +786,8 @@ device power-off. The images are:

    persisting it at device power-off.

    The /cache partition image is initially empty, and is used by -the browser to cache downloaded web pages and images. The emulator provides an --cache <file>, which specifies the name of the file at which +the browser to cache downloaded web pages and images. The emulator provides an +-cache <file>, which specifies the name of the file in which to persist the /cache image at device power-off. If <file> does not exist, the emulator creates it as an empty file.

    @@ -918,16 +795,14 @@ to persist the /cache image at device power-off. If <file& -nocache option at startup.

    - -

    Emulator Networking

    +

    Emulator Networking

    The emulator provides versatile networking capabilities that you can use to set up complex modeling and testing environments for your application. The sections below introduce the emulator's network architecture and capabilities.

    - -

    Network Address Space

    +

    Network Address Space

    Each instance of the emulator runs behind a virtual router/firewall service that isolates it from your development machine's network interfaces and settings @@ -990,14 +865,13 @@ specific to the Android emulator and will probably be very different on real devices (which are also very likely to be NAT-ed, i.e., behind a router/firewall)

    - -

    Local Networking Limitations

    -

    Each emulator instance runs behind a virtual router, but unlike an actual -device connected to a physical router, the emulated device doesn't have access -to a physical network. Instead it runs as part of a normal application on your -development machine. This means that it is subject to the same networking -limitations as other applications on your machine:

    +

    Local Networking Limitations

    + +

    Android applications running in an emulator can connect to the network available on your +workstation. However, they connect through the emulator, not directly to hardware, and the emulator +acts like a normal application on your workstation. This means that the emulator, and thus your +Android applications, are subject to some limitations:

    - -

    Sending a Voice Call or SMS to Another Emulator Instance

    +

    Sending a Voice Call or SMS to Another Emulator Instance

    -

    The emulator automatically forwards simulated voice calls and SMS messages from one instance to another. To send a voice call or SMS, you use the dialer application and SMS application (if available) installed on one emulator

    +

    The emulator automatically forwards simulated voice calls and SMS messages from one instance to +another. To send a voice call or SMS, use the dialer application or SMS application, respectively, +from one of the emulators.

    To initiate a simulated voice call to another emulator instance:

      @@ -1186,16 +1059,23 @@ B:10.0.2.15:<serverPort>

      You can also connect to an emulator instance's console to simulate an incoming voice call or SMS. For more information, see Telephony Emulation and SMS Emulation. - -

      Using the Emulator Console

      +

      Using the Emulator Console

      + +

      Each running emulator instance provides a console that lets you query and control the emulated +device environment. For example, you can use the console to manage port redirection, network +characteristics, and telephony events while your application is running on the emulator. To +access the console and enter commands, use telnet to connect to the console's port number.

      -

      Each running emulator instance includes a console facility that lets you dynamically query and control the simulated device environment. For example, you can use the console to dynamically manage port redirections and network characteristics and simulate telephony events. To access the console and enter commands, you use telnet to connect to the console's port number.

      To connect to the console of any running emulator instance at any time, use this command:

      telnet localhost <console-port>
      -

      An emulator instance occupies a pair of adjacent ports: a console port and an adb port. The port numbers differ by 1, with the adb port having the higher port number. The console of the first emulator instance running on a given machine uses console port 5554 and adb port 5555. Subsequent instances use port numbers increasing by two — for example, 5556/5557, 5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility.

      +

      An emulator instance occupies a pair of adjacent ports: a console port and an {@code adb} port. +The port numbers differ by 1, with the {@code adb} port having the higher port number. The console +of the first emulator instance running on a given machine uses console port 5554 and {@code adb} +port 5555. Subsequent instances use port numbers increasing by two — for example, 5556/5557, +5558/5559, and so on. Up to 16 concurrent emulator instances can run a console facility.

      To connect to the emulator console, you must specify a valid console port. If multiple emulator instances are running, you need to determine the console port of the emulator instance you want to connect to. You can find the instance's console port listed in the title of the instance window. For example, here's the window title for an instance whose console port is 5554:

      @@ -1209,12 +1089,14 @@ B:10.0.2.15:<serverPort>

      To exit the console session, use quit or exit.

      -

      The sections below describe the major functional areas of the console.

      +

      The following sections below describe the major functional areas of the console.

      + - +

      Port Redirection

      + +

      You can use the console to add and remove port redirection while the emulator is running. After +you connect to the console, manage port redirection by entering the following command:

      -

      Port Redirection

      -

      You can use the console to add and remove port redirections while the emulator is running. After connecting to the console, you can manage port redirections in this way:

      redir <list|add|del> 

      The redir command supports the subcommands listed in the table below.

      @@ -1225,14 +1107,14 @@ B:10.0.2.15:<serverPort> Description Comments - + list - List the current port redirections. + List the current port redirection.   - + add <protocol>:<host-port>:<guest-port> Add a new port redirection. @@ -1244,16 +1126,16 @@ B:10.0.2.15:<serverPort> del <protocol>:<host-port> Delete a port redirection. -See above for meanings of <protocol> and <host-port>. +The meanings of <protocol> and <host-port> are listed in the previous row. - -

      Geo Location Provider Emulation

      -

      The console provides commands to let you set the geo position used by an emulator emulated device. -You can use the geo command to send a simple GPS fix to the emulator, without needing to -use NMEA 1083 formatting. The usage for the command is:

      +

      Geo Location Provider Emulation

      + +

      You can use the console to set the geographic location reported to the applications running +inside an emulator. Use the geo command to send a simple GPS fix to the +emulator, with or without NMEA 1083 formatting:

      geo <fix|nmea>
      @@ -1261,11 +1143,11 @@ use NMEA 1083 formatting. The usage for the command is:

      - + + - + @@ -1278,19 +1160,21 @@ use NMEA 1083 formatting. The usage for the command is:

      Subcommand - DescriptionSubcommandDescription Comments
      fix <longitude> <latitude> [<altitude>] Send a simple GPS fix to the emulator instance.
      -

      You can issue the geo command to fix the GPS location as soon as an emulator instance is running. -The emulator creates a mock location provider that sends it to GPS-aware applications as soon as they start and -register location listeners. Any application can query the location manager to obtain the current GPS fix for the -emulated device by calling: +

      You can issue the geo command as soon as an emulator instance is running. The +emulator sets the location you enter by creating a mock location provider. This provider responds to +location listeners set by applications, and also supplies the location to the {@link +android.location.LocationManager}. Any application can query the location manager to obtain the +current GPS fix for the emulated device by calling:

      LocationManager.getLastKnownLocation("gps")
      -

      For more information about the Location Manager, see {@link android.location.LocationManager} and its methods.

      +

      For more information about the Location Manager, see {@link android.location.LocationManager}. +

      - -

      Hardware Events Emulation

      +

      Hardware Events Emulation

      -

      You can use the event command to send various events to the emulator.The usage for the command is:

      +

      The {@code event} console commands sends hardware events to the emulator. The syntax for this +command is as follows:

      event <send|types|codes|text>
      @@ -1302,7 +1186,7 @@ emulated device by calling: Description Comments - + send <type>:<code>:<value> [...] Send one or more events to the Android kernel. @@ -1315,7 +1199,7 @@ emulated device by calling: codes <type> - List all <codes> string aliases supported by the event + List all <codes> string aliases supported by the event subcommands for the specified <type>.   @@ -1326,10 +1210,11 @@ emulated device by calling: - -

      Device Power Characteristics

      -

      You can use the power command to control the simulated power state of the emulator instance.The usage for the command is:

      +

      Device Power Characteristics

      + +

      The {@code power} command controls the power state reported by the emulator to applications. The +syntax for this command is as follows:

      power <display|ac|status|present|health|capacity>
      @@ -1341,7 +1226,7 @@ emulated device by calling: Description Comments - + display Display battery and charger state. @@ -1375,23 +1260,32 @@ emulated device by calling: - -

      Network Status

      + +

      Network Status

      You can use the console to check the network status and current delay and speed characteristics. To do so, connect to the console and use the netstatus command. Here's an example of the command and its output.

      network status
       
      - -

      Network Delay Emulation

      -

      The emulator lets you simulate various network latency levels, so that you can test your application in an environment more typical of the actual conditions in which it will run. You can set a latency level or range at emulator startup or you can use the console to change the latency dynamically, while the application is running in the emulator.

      -

      To set latency at emulator startup, use the -netdelay emulator option with a supported <delay> value, as listed in the table below. Here are some examples:

      +

      Network Delay Emulation

      + +

      The emulator lets you simulate various network latency levels, so that you can test your +application in an environment more typical of the actual conditions in which it will run. You can +set a latency level or range at emulator startup or you can use the console to change the latency, +while the application is running in the emulator.

      + +

      To set latency at emulator startup, use the -netdelay emulator option with a +supported <delay> value, as listed in the table below. Here are some +examples:

      +
      emulator -netdelay gprs
       emulator -netdelay 40 100
      -

      To make dynamic changes to network delay while the emulator is running, connect to the console and use the netdelay command with a supported <delay> value from the table below.

      +

      To make changes to network delay while the emulator is running, connect to the console and use +the netdelay command with a supported <delay> value from the table +below.

      network delay gprs
      @@ -1401,7 +1295,7 @@ emulator -netdelay 40 100 Value DescriptionComments - + gprsGPRS (min 150, max 550) @@ -1421,19 +1315,22 @@ emulator -netdelay 40 100   - -

      Network Speed Emulation

      -

      The emulator also lets you simulate various network transfer rates. -You can set a transfer rate or range at emulator startup or you can use the console to change the rate dynamically, -while the application is running in the emulator.

      +

      Network Speed Emulation

      + +

      The emulator also lets you simulate various network transfer rates. +You can set a transfer rate or range at emulator startup or you can use the console to change the +rate, while the application is running in the emulator.

      To set the network speed at emulator startup, use the -netspeed emulator option with a supported <speed> value, as listed in the table below. Here are some examples:

      +
      emulator -netspeed gsm
       emulator -netspeed 14.4 80
      -

      To make dynamic changes to network speed while the emulator is running, connect to the console and use the netspeed command with a supported <speed> value from the table below.

      +

      To make changes to network speed while the emulator is running, connect to the console and use +the netspeed command with a supported <speed> value from the table +below.

      network speed 14.4 80
      @@ -1444,7 +1341,7 @@ kilobits/sec):

      Value DescriptionComments - + gsm GSM/CSD(Up: 14.4, down: 14.4) @@ -1476,14 +1373,19 @@ kilobits/sec):

      Set exact rates for upload and download separately. - -

      Telephony Emulation

      +

      Telephony Emulation

      + +

      The Android emulator includes its own GSM emulated modem that lets you simulate telephony +functions in the emulator. For example, you can simulate inbound phone calls, establish data +connections and terminate them. The Android system handles simulated calls exactly as it would +actual calls. The emulator does not support call audio.

      + +

      You can use the {@code gsm} command to access the emulator's telephony functions after connecting +to the console. The syntax for this command is as follows:

      -

      The Android emulator includes its own GSM emulated modem that lets you simulate telephony functions in the emulator. For example, you can simulate inbound phone calls and establish/terminate data connections. The Android system handles simulated calls exactly as it would actual calls. The emulator does not support call audio in this release.

      -

      You can use the console to access the emulator's telephony functions. After connecting to the console, you can use

      gsm <call|accept|busy|cancel|data|hold|list|voice|status> 
      -

      to invoke telephony functions.

      +

      The gsm command supports the subcommands listed in the table below.

      @@ -1559,11 +1461,12 @@ kilobits/sec):

      - -

      SMS Emulation

      +

      SMS Emulation

      -

      The Android emulator console lets you generate an SMS message and direct it to an emulator instance. Once you connect to an emulator instance, you can generate an emulated incoming SMS using this command:

      +

      The Android emulator console lets you generate an SMS message and direct it to an emulator +instance. Once you connect to an emulator instance, you can generate an emulated incoming SMS using +the following command:

      sms send <senderPhoneNumber> <textmessage>
      @@ -1571,11 +1474,11 @@ kilobits/sec):

      The console forwards the SMS message to the Android framework, which passes it through to an application that handles that message type.

      - -

      VM State

      +

      VM State

      -

      You can use the vm command to control the VM on an emulator instance.The usage for the command is:

      +

      You can use the vm command to control the VM on an emulator instance. The syntax for +this command is as follows:

      vm <start|stop|status>
      @@ -1583,8 +1486,8 @@ kilobits/sec):

      - - + + @@ -1605,11 +1508,10 @@ kilobits/sec):

      Subcommand DescriptionSubcommandDescription Comments
      - +

      Emulator Window

      -

      Emulator Window

      - -

      You can use the window command to manage the emulator window. The usage for the command is:

      +

      You can use the window command to manage the emulator window. The syntax for this +command is as follows:

      window <scale>
      @@ -1617,158 +1519,53 @@ kilobits/sec):

      - + + -
      Subcommand - DescriptionSubcommandDescription Comments
      scale <scale> Scale the emulator window.<scale> must be a number between 0.1 and 3 that describes the desired scaling factor. You can - also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto" + A number between 0.1 and 3 that sets the scaling factor. You can + also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto" tells the emulator to select the best window size.
      - - -

      Terminating an Emulator Instance

      +

      Terminating an Emulator Instance

      You can terminate an emulator instance through the console, using the kill command.

      - - -

      Using Emulator Skins

      - -

      The Android SDK includes several Emulator skins that you can use to control the resolution and density of the emulated device's screen. To select a specific skin for running the emulator, create an AVD that uses that skin. Please do not use deprecated emulator options such as -skin to control the skin used by an emulator instance. For more information about AVDs, see Managing Virtual Devices.

      - - - - -

      Running Multiple Emulator Instances

      - -

      Through the AVDs configurations used by the emulator, you can run multiple -instances of the emulator concurrently, each with its own AVD configuration and -storage area for user data, SD card, and so on. You no longer need to use the --d option when launching the emulator, to point to an -instance-specific storage area.

      - - - -

      Installing Applications on the Emulator

      - -

      If you don't have access to Eclipse or the ADT Plugin, you can install -your application on the emulator using -the adb utility. Before installing the application, you need to build and package it -into an .apk as described in Building and -Running Apps. Once the application is installed, you can start the emulator from the command -line, as described in this document, using any startup options necessary. -When the emulator is running, you can also connect to the emulator instance's -console to issue commands as needed.

      - -

      As you update your code, you periodically package and install it on the emulator. -The emulator preserves the application and its state data across restarts, -in a user-data disk partition. To ensure that the application runs properly -as you update it, you may need to delete the emulator's user-data partition. -To do so, start the emulator with the -wipe-data option. -For more information about the user-data partition and other emulator storage, -see Working with Emulator Disk Images.

      +

      Emulator Limitations

      - - - -

      SD Card Emulation

      - -

      You can create a disk image and then load it to the emulator at startup, to -simulate the presence of a user's SD card in the device. To do this, you can use -the android tool to create a new SD card image with a new AVD, or you can use -the mksdcard utility included in the SDK.

      - -

      The sections below describe how to create an SD card disk image, how to copy -files to it, and how to load it in the emulator at startup.

      - -

      Note that you can only load disk image at emulator startup. Similarly, you -can not remove a simulated SD card from a running emulator. However, you can -browse, send files to, and copy/remove files from a simulated SD card either -with adb or the emulator.

      - -

      The emulator supports emulated SDHC cards, so you can create an SD card image -of any size up to 128 gigabytes.

      - -

      Creating an SD card image using the android tool

      - -

      The easiest way to create a new SD card is to use the android tool. When -creating an AVD, you simply specify the -c option, like this:

      - -
      android create avd -n <avd_name> -t <targetID> -c <size>[K|M]
      - -

      You can also use the -c option to specify a path to an SD card -image to use in the new AVD. For more information, see Managing Virtual Devices -from the Command Line. -

      - -

      Creating an SD card image using mksdcard

      - -

      You can use the mksdcard tool, included in the SDK, to create a FAT32 disk -image that you can load in the emulator at startup. You can access mksdcard in -the tools/ directory of the SDK and create a disk image like this:

      - -
      mksdcard <size> <file>
      - -

      For example:

      - -
      mksdcard 1024M sdcard1.iso
      - -

      For more information, see mksdcard.

      - - -

      Copying Files to a Disk Image

      - -

      Once you have created the disk image, you can copy files to it prior to -loading it in the emulator. To copy files, you can mount the image as a loop -device and then copy the files to it, or you can use a utility such as mtools to -copy the files directly to the image. The mtools package is available for Linux, -Mac, and Windows.

      - - - - -

      Loading the Disk Image at Emulator Startup

      - -

      By default, the emulator loads the SD card image that is stored with the active -AVD (see the -avd startup option).

      - -

      Alternatively, you ca start the emulator with the --sdcard flag and specify the name and path of your image (relative -to the current working directory):

      - -
      emulator -sdcard <filepath>
      +

      The functional limitations of the emulator include:

      + - -

      Troubleshooting Emulator Problems

      +

      Troubleshooting Emulator Problems

      -

      The adb utility sees the emulator as an actual physical device. For this reason, you might have to use the -d flag with some common adb commands, such as install. The -d flag lets you specify which of several connected devices to use as the target of a command. If you don't specify -d, the emulator will target the first device in its list. For more information about adb, see Android Debug Bridge.

      +

      The {@code adb} utility sees the emulator as an actual physical device. For this reason, you +might have to use the {@code -d} flag with some common {@code adb} commands, such as +install. The {@code -d} flag lets you specify which of several connected devices to use +as the target of a command. If you don't specify {@code -d}, the emulator targets the first +device in its list. For more information about {@code adb}, see Android Debug Bridge.

      -

      For emulators running on Mac OS X, if you see an error "Warning: No DNS servers found" when starting the emulator, check to see whether you have an /etc/resolv.conf file. If not, please run the following line in a command window:

      +

      For emulators running on Mac OS X, if you see an error {@code Warning: No DNS servers found} +when starting the emulator, check to see whether you have an /etc/resolv.conf file. If +not, please run the following line in a command window:

      ln -s /private/var/run/resolv.conf /etc/resolv.conf
      -

      See Frequently Asked Questions for more troubleshooting information.

      - - -

      Emulator Limitations

      -

      In this release, the limitations of the emulator include:

      - +

      See Frequently Asked Questions for more +troubleshooting information.

      diff --git a/docs/html/guide/developing/tools/emulator.jd b/docs/html/guide/developing/tools/emulator.jd index 09e41c3a17c2..21d4263a9e12 100644 --- a/docs/html/guide/developing/tools/emulator.jd +++ b/docs/html/guide/developing/tools/emulator.jd @@ -8,8 +8,8 @@ parent.link=index.html

      In this document

        -
      1. Emulator Startup Options
      2. -
      3. Emulator Keyboard Mapping
      4. +
      5. Keyboard Commands
      6. +
      7. Command Line Parameters

      See also

      @@ -22,30 +22,123 @@ parent.link=index.html -

      The Android SDK includes a mobile device emulator — a virtual mobile device +

      The Android SDK includes a mobile device emulator — a virtual mobile device that runs on your computer. The emulator lets you develop and test Android applications without using a physical device.

      -

      When the emulator is running, you can interact with the emulated mobile -device just as you would an actual mobile device, except that you use your mouse -pointer to "touch" the touchscreen and can use some keyboard keys to -invoke certain keys on the device.

      - -

      This document is a reference to the available command line options and the keyboard mapping to device keys. -For a complete guide to using the Android Emulator, see +

      This document is a reference to the available command line options and the keyboard mapping to +device keys. +For a complete guide to using the Android Emulator, see Using the Android Emulator. -

      Emulator Startup Options

      +

      Keyboard Commands

      -

      The emulator supports a variety of options that you can specify -when launching the emulator, to control its appearance or behavior. -Here's the command-line usage for launching the emulator with options:

      +

      Table 1 summarizes the mappings between the emulator keys and the keys of your keyboard.

      -
      emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]
      +

      Table 1. Emulator keyboard mapping

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -

      Table 1.Emulator startup options

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Emulated Device Key Keyboard Key
      HomeHOME
      Menu (left softkey)F2 or Page-up button
      Star (right softkey)Shift-F2 or Page Down
      BackESC
      Call/dial button F3
      Hangup/end call buttonF4
      SearchF5
      Power buttonF7
      Audio volume up buttonKEYPAD_PLUS, Ctrl-F5
      Audio volume down buttonKEYPAD_MINUS, Ctrl-F6
      Camera buttonCtrl-KEYPAD_5, Ctrl-F3
      Switch to previous layout orientation (for example, portrait, landscape)KEYPAD_7, Ctrl-F11
      Switch to next layout orientation (for example, portrait, landscape)KEYPAD_9, Ctrl-F12
      Toggle cell networking on/offF8
      Toggle code profilingF9 (only with -trace startup option)
      Toggle fullscreen modeAlt-Enter
      Toggle trackball modeF6
      Enter trackball mode temporarily (while key is pressed)Delete
      DPad left/up/right/downKEYPAD_4/8/6/2
      DPad center clickKEYPAD_5
      Onion alpha increase/decreaseKEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)
      + + +

      Command Line Parameters

      +

      The emulator supports a variety of options that you can specify +when launching the emulator, to control its appearance or behavior. +Here's the command-line syntax of the options available to the {@code emulator} program:

      + +
      emulator -avd <avd_name> [-<option> [<value>]] ... [-<qemu args>]
      + +

      Table 2. Emulator command line parameters

      @@ -54,51 +147,6 @@ Here's the command-line usage for launching the emulator with options:

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + information, see Managing + AVDs with AVD Manager. - - - + - - - - - @@ -163,8 +205,9 @@ on disk images, use -help-disk-images.

      - @@ -178,17 +221,17 @@ on disk images, use -help-disk-images.

      - --> - - @@ -196,7 +239,7 @@ on disk images, use -help-disk-images.

      - @@ -217,16 +260,16 @@ on disk images, use -help-disk-images.

      - - - - @@ -316,8 +359,9 @@ ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, s - + @@ -326,18 +370,19 @@ ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, s - - - - + @@ -362,9 +407,9 @@ scale in direct relationship with <delay> values.

      @@ -372,18 +417,37 @@ scale in direct relationship with <delay> values.

      - - + + + + + + + + + + - @@ -419,8 +483,8 @@ scale in direct relationship with <delay> values.

      - @@ -434,7 +498,7 @@ scale in direct relationship with <delay> values.

      - @@ -460,113 +524,58 @@ option. Using this option may yield unexpected and in some cases misleading results, since the density with which to render the skin may not be defined. AVDs let you associate each skin with a default density and override the default as needed. For more information, see -Managing Virtual Devices with AVD Manager. +href="{@docRoot}guide/developing/devices/managing-avds.html">Managing Virtual Devices +with AVD Manager. - -
      Category Comments
      Help-helpPrint a list of all emulator options. 
      -help-allPrint help for all startup options. 
      -help-<option>Print help for a specific startup option. 
      -help-debug-tagsPrint a list of all tags for -debug <tags>. 
      -help-disk-imagesPrint help for using emulator disk images. 
      -help-environmentPrint help for emulator environment variables. 
      -help-keysPrint the current mapping of keys. 
      -help-keyset-filePrint help for defining a custom key mappings file. 
      -help-virtual-devicePrint help for Android Virtual Device usage. 
      AVD -avd <avd_name> or
      @@ -106,55 +154,49 @@ Here's the command-line usage for launching the emulator with options:

      Required. Specifies the AVD to load for this emulator instance. You must create an AVD configuration before launching the emulator. For - information, see - Managing AVDs with AVD Manager.
      Disk Images -cache <filepath> Use <filepath> as the working cache partition image. Optionally, you can specify a path relative to the current working directory. + An absolute or relative path to the current working directory. If no cache file is specified, the emulator's default behavior is to use a temporary file instead.

      For more information on disk images, use -help-disk-images.

      -data <filepath>Use <filepath> as the working user-data disk image. Optionally, you can specify a path relative to the current working directory. - If -data is not used, the emulator looks for a file named "userdata-qemu.img" - in the storage area of the AVD being used (see -avd). + Use {@code <filepath>} as the working user-data disk image. Optionally, you can specify a path relative to the current working directory. + If -data is not used, the emulator looks for a file named {@code userdata-qemu.img} + in the storage area of the AVD being used (see -avd).
      -initdata <filepath>When resetting the user-data image (through -wipe-data), copy the contents + When resetting the user-data image (through -wipe-data), copy the contents of this file to the new user-data disk image. By default, the emulator copies the <system>/userdata.img.Optionally, you can specify a path relative to the current working directory. See also -wipe-data.

      For more information on disk images, use -help-disk-images.

      -nocache Start the emulator without a cache partition.
      -ramdisk <filepath> Use <filepath> as the ramdisk image.Default value is <system>/ramdisk.img. -

      Optionally, you can specify a path relative to the current working directory. For more information on disk images, use -help-disk-images.

      +
      Default value is <system>/ramdisk.img. +

      Optionally, you can specify a path relative to the current working directory. + For more information on disk images, use -help-disk-images.

      -system <dirpath> Search for system, ramdisk and user data images in <dir>.<dir> is a directory path relative to the current + <dir> is a directory path relative to the current working directory.
      -wipe-dataReset the current user-data disk image (that is, the file specified by -datadir and - -data, or the default file). The emulator deletes all data from the user data image file, - then copies the contents of the file at -inidata data to the image file before starting. + Reset the current user-data disk image (that is, the file specified by -datadir and + -data, or the default file). The emulator deletes all data from the user data image file, + then copies the contents of the file at -inidata data to the image file before starting. See also -initdata. + See also -initdata.

      For more information on disk images, use -help-disk-images.

      Debug -debug <tags> Enable/disable debug messages for the specified debug tags.<tags> is a space/comma/column-separated list of debug component names. + <tags> is a space/comma/column-separated list of debug component names. Use -help-debug-tags to print a list of debug component names that you can use.
      -shell Create a root shell console on the current terminal.You can use this command even if the adb daemon in the emulated system is broken. + You can use this command even if the adb daemon in the emulated system is broken. Pressing Ctrl-c from the shell stops the emulator instead of the shell.
      -shell-serial <device>Enable the root shell (as in -shell and specify the QEMU character + Enable the root shell (as in -shell and specify the QEMU character device to use for communication with the shell.<device> must be a QEMU device type. See the documentation for '-serial dev' at - wiki.qemu.org - for more information.

      +
      <device> must be a QEMU device type. See the documentation for '-serial dev' at + http://wiki.qemu.org/download/qemu-doc.html + for a list of device types.

      Here are some examples:

        @@ -250,11 +293,11 @@ on disk images, use -help-disk-images.

      -verbose Enable verbose output.Equivalent to -debug-init. -

      You can define the default verbose output options used by emulator instances in the Android environment variable -ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option: +

      Equivalent to -debug-init. +

      You can define the default verbose output options used by emulator instances in the Android environment variable +ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, specifying only the stem of each option: -debug-<tags>.

      -

      Here's an example showing ANDROID_VERBOSE defined with the -debug-init and -debug-modem options: +

      Here's an example showing ANDROID_VERBOSE defined with the -debug-init and -debug-modem options:

      ANDROID_VERBOSE=init,modem

      For more information about debug tags, use <-help-debug-tags>.

      -netdelay <delay> Set network latency emulation to <delay>.Default value is none. See the table in Network Delay Emulation for - supported <delay> values. Default value is none. See the table in + Network Delay Emulation + for supported <delay> values.
      -netfast
      -netspeed <speed> Set network speed emulation to <speed>.Default value is full. See the table in Network Speed Emulation for + Default value is full. See the table in + Network Speed Emulation for supported <speed> values.
      -port <port> Set the console port number for this emulator instance to <port>.The console port number must be an even integer between 5554 and 5584, inclusive. <port>+1 + The console port number must be an even integer between 5554 and 5584, inclusive. <port>+1 must also be free and will be reserved for ADB.
      -report-console <socket>Report the assigned console port for this emulator instance to a remote third party + Report the assigned console port for this emulator instance to a remote third party before starting the emulation. <socket> must use one of these formats: @@ -347,14 +392,14 @@ ANDROID_VERBOSE. Define the options you want to use in a comma-delimited list, s

      Use -help-report-console

      to view more information about this topic.
      SystemSystem -cpu-delay <delay> Slow down emulated CPU speed by <delay> Supported values for <delay> are integers between 0 and 1000. -

      Note that the <delay> does not correlate to clock speed or other absolute metrics -— it simply represents an abstract, relative delay factor applied non-deterministically -in the emulator. Effective performance does not always +

      Note that the <delay> does not correlate to clock speed or other absolute metrics +— it simply represents an abstract, relative delay factor applied non-deterministically +in the emulator. Effective performance does not always scale in direct relationship with <delay> values.

      -gps <device> Redirect NMEA GPS to character device. Use this command to emulate an NMEA-compatible GPS unit connected to - an external character device or socket. The format of <device> must be QEMU-specific - serial device specification. See the documentation for 'serial -dev' at - http://www.bellard.org/qemu/qemu-doc.html#SEC10. + an external character device or socket. The format of <device> must be QEMU-specific + serial device specification. See the documentation for 'serial -dev' at + http://wiki.qemu.org/download/qemu-doc.html.
      Disable JNI checks in the Dalvik runtime. 
      -qemuPass arguments to qemu. 
      Pass arguments to the qemu emulator software.

      Important: When using this option, make sure it is the + last option specified, since all options after it are interpretted as qemu-specific + options.

      -qemu -enable-kvmEnable KVM acceleration of the emulator virtual machine.This option is only effective when your system is set up to use + KVM-based VM acceleration. + You can optionally specify a memory size ({@code -m <size>}) for the VM, which should match + your emulator's memory size:

      + {@code -qemu -m 512 -enable-kvm}
      + {@code -qemu -m 1024 -enable-kvm} +
      -qemu -h Display qemu help.
      -gpu onTurn on graphics acceleration for the emulator.This option is only available for emulators using a system image with API Level 15, revision 3 + and higher. For more information, see + Using the Android + Emulator.
      -radio <device> Redirect radio mode to the specified character device.The format of <device> must be QEMU-specific - serial device specification. See the documentation for 'serial -dev' at -http://www.bellard.org/qemu/qemu-doc.html#SEC10. + The format of <device> must be QEMU-specific + serial device specification. See the documentation for 'serial -dev' at +http://wiki.qemu.org/download/qemu-doc.html.
      -scale <scale> Scale the emulator window. <scale> is a number between 0.1 and 3 that represents the desired scaling factor. You can - also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto" + <scale> is a number between 0.1 and 3 that represents the desired scaling factor. You can + also specify scale as a DPI value if you add the suffix "dpi" to the scale value. A value of "auto" tells the emulator to select the best window size.
      -keyset <file> Use the specified keyset file instead of the default.The keyset file defines the list of key bindings between the emulator and the host keyboard. + The keyset file defines the list of key bindings between the emulator and the host keyboard. For more information, use -help-keyset to print information about this topic.
      -skindir <dir> This emulator option is deprecated. See comments for -skin, above.
      - - - -

      Emulator Keyboard Mapping

      - -

      The table below summarizes the mappings between the emulator keys and and -the keys of your keyboard.

      -

      Table 2. Emulator keyboard mapping

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + s + + + + + + + + + + + + + + +
      Emulated Device Key Keyboard Key
      HomeHOME
      Menu (left softkey)F2 or Page-up button
      Star (right softkey)Shift-F2 or Page Down
      BackESC
      Call/dial button F3
      Hangup/end call buttonF4
      SearchF5
      Power buttonF7
      Audio volume up buttonKEYPAD_PLUS, Ctrl-F5
      Audio volume down buttonKEYPAD_MINUS, Ctrl-F6
      Camera buttonCtrl-KEYPAD_5, Ctrl-F3
      Switch to previous layout orientation (for example, portrait, landscape)KEYPAD_7, Ctrl-F11
      Switch to next layout orientation (for example, portrait, landscape)KEYPAD_9, Ctrl-F12
      Toggle cell networking on/offF8
      Toggle code profilingF9 (only with -trace startup option)
      Toggle fullscreen modeAlt-Enter
      Toggle trackball modeF6
      Enter trackball mode temporarily (while key is pressed)Delete
      DPad left/up/right/downKEYPAD_4/8/6/2
      DPad center clickKEYPAD_5
      Onion alpha increase/decreaseKEYPAD_MULTIPLY(*) / KEYPAD_DIVIDE(/)
      See comments for -skin, above.
      Help-helpPrint a list of all emulator options. 
      -help-allPrint help for all startup options. 
      -help-<option>Print help for a specific startup option. 
      -help-debug-tagsPrint a list of all tags for -debug <tags>. 
      -help-disk-imagesPrint help for using emulator disk images. 
      -help-environmentPrint help for emulator environment variables. 
      -help-keysPrint the current mapping of keys. 
      -help-keyset-filePrint help for defining a custom key mappings file. 
      -help-virtual-devicePrint help for Android Virtual Device usage. 
      - -

      Note that, to use keypad keys, you must first disable NumLock on your development computer.

      diff --git a/docs/html/images/emulator-wvga800l.png b/docs/html/images/emulator-wvga800l.png index a2140338a469..c92c1b968236 100644 Binary files a/docs/html/images/emulator-wvga800l.png and b/docs/html/images/emulator-wvga800l.png differ -- cgit v1.2.3-59-g8ed1b