Mã hóa file config c bằng pre-build event

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

This page describes command-line features that you can use with the Android Emulator. For information about using the Android Emulator UI, see Run apps on the Android Emulator.

Start the emulator

Use the

emulator @Nexus_5X_API_23 -memory 2048

5 command to start the emulator, as an alternative to or .

Here's the basic command-line syntax for starting a virtual device from a terminal prompt:

emulator -avd avd_name [ {-option [value]} … ]

Or

emulator @avd_name [ {-option [value]} … ]

For example, if you launch the emulator from within Android Studio running on a Mac, the default command line will be similar to the following:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

You can specify startup options when you start the emulator, but not after it has started.

For a list of AVD names, enter the following command:

emulator -list-avds

Use this option to display a list of AVD names from your Android home directory. You can override the default home directory by setting the

emulator @Nexus_5X_API_23 -memory 2048

6 environment variable that specifies the root of the user-specific directory where all configuration and AVD content is stored.

You can set the environment variable in the terminal window before launching a virtual device or through your user settings in the operating system. For example, in your

emulator @Nexus_5X_API_23 -memory 2048

7 file on Linux.

To stop the Android Emulator, close the emulator window.

Install an app

In addition to installing an app through Android Studio or the , you can install your app on a virtual device by using the utility.

To use

emulator @Nexus_5X_API_23 -memory 2048

8 to install, run, and test your app, follow these general steps:

  1. Build and package your app into an APK, as described in Build and run your app.
  2. Start the emulator from the command line, as described in the previous section, using any startup options necessary.
  3. Install your app using .
  4. Run and test your app on the emulator. While the emulator is running, you can use the Emulator console to issue commands as needed.

To uninstall an app, do so as you would on an Android device.

The virtual device preserves the app and its state data across restarts in a user data disk partition (

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

1). To clear this data, start the emulator with the

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

2 option or wipe the data in the AVD Manager. For more information about the user data partition and other storage, see the following section.

Note: The

emulator @Nexus_5X_API_23 -memory 2048

8 utility views the virtual device as an actual physical device. For this reason, you might have to use the

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

4 flag with some common

emulator @Nexus_5X_API_23 -memory 2048

8 commands, such as

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

6. The

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

4 flag lets you specify which of several connected devices to use as the target of a command. If you don't specify

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

4, the emulator targets the first device in its list.

Understand the default directories and files

The emulator uses associated files, of which the AVD system and data directories are the most important. It's helpful to understand the emulator directory structure and files when specifying command-line options, although you typically don't need to modify the default directories or files.

The Android Emulator uses the Quick Emulator (QEMU) hypervisor. Initial versions of the Android Emulator used QEMU 1 (goldfish), and later versions use QEMU 2 (ranchu).

AVD system directory

The system directory contains the Android system images that the emulator uses to simulate the operating system. This directory has platform-specific, read-only files shared by all AVDs of the same type, including API level, CPU architecture, and Android variant. The default locations are the following:

  • macOS and Linux - emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img 9
  • Microsoft Windows XP - emulator @Nexus_5X_API_23 -wipe-data 0
  • Windows Vista - emulator @Nexus_5X_API_23 -wipe-data 1

Where:

  • emulator @Nexus_5X_API_23 -wipe-data 2 is a numeric API level or a letter for preview releases. For example, emulator @Nexus_5X_API_23 -wipe-data 3 indicates the Android Marshmallow preview. On release, it became API level 23, designated by emulator @Nexus_5X_API_23 -wipe-data 4.
  • emulator @Nexus_5X_API_23 -wipe-data 5 is a name corresponding to specific features implemented by the system image. For example, emulator @Nexus_5X_API_23 -wipe-data 6 or emulator @Nexus_5X_API_23 -wipe-data 7.
  • emulator @Nexus_5X_API_23 -wipe-data 8 is the target CPU architecture. For example, emulator @Nexus_5X_API_23 -wipe-data 9.

Use the

emulator @avd_name [ {-option [value]} … ]

00 option to specify a different system directory for the AVD.

The emulator reads the following files from the system directory:

Table 1. System directory files read by the Android Emulator

File Description Option to specify a different file

emulator @avd_name [ {-option [value]} … ]

01 or

emulator @avd_name [ {-option [value]} … ]

02 The binary kernel image for the AVD.

emulator @avd_name [ {-option [value]} … ]

02 is the QEMU 2 emulator, the latest version.

emulator @avd_name [ {-option [value]} … ]

04

emulator @avd_name [ {-option [value]} … ]

05 The boot partition image. This is a subset of

emulator @avd_name [ {-option [value]} … ]

06 loaded by the kernel initially before the system image is mounted. It typically contains just a few binaries and initialization scripts.

emulator @avd_name [ {-option [value]} … ]

07

emulator @avd_name [ {-option [value]} … ]

06 The read-only, initial version of the system image. Specifically, the partition containing the system libraries and data corresponding to the API level and variant.

emulator @avd_name [ {-option [value]} … ]

09

emulator @avd_name [ {-option [value]} … ]

10 The initial version of the data partition, which appears as

emulator @avd_name [ {-option [value]} … ]

11 in the emulated system and contains all writable data for the AVD. The emulator uses this file when you create a new AVD or use the

emulator @avd_name [ {-option [value]} … ]

12 option. For more information, see the

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

1 file description in the following section.

emulator @avd_name [ {-option [value]} … ]

14

emulator @avd_name [ {-option [value]} … ]

15

AVD data directory

The AVD data directory, also called the content directory, is specific to a single AVD instance and contains all modifiable data for the AVD.

The default location is the following, where

emulator @avd_name [ {-option [value]} … ]

16 is the AVD name:

  • macOS and Linux - emulator @avd_name [ {-option [value]} … ] 17
  • Microsoft Windows XP - emulator @avd_name [ {-option [value]} … ] 18
  • Windows Vista, and higher - emulator @avd_name [ {-option [value]} … ] 19

Use the

emulator @avd_name [ {-option [value]} … ]

20 option to specify a different AVD data directory.

The following table lists the most important files contained in this directory:

Table 2. Important files in the AVD data directory

File Description Option to specify a different file

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

1

The content of the data partition, which appears as

emulator @avd_name [ {-option [value]} … ]

11 in the emulated system. When you create a new AVD or when you use the

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

2 option to reset the AVD to the factory defaults, the emulator copies the

emulator @avd_name [ {-option [value]} … ]

10 file in the system directory to create this file.

Each virtual device instance uses a writable user-data image to store user and session-specific data. For example, it uses the image to store a unique user's installed app data, settings, databases, and files. Each user has a different

emulator @Nexus_5X_API_23 -memory 2048

6 directory that stores the data directories for the AVDs created by that user. Each AVD has a single

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

1 file.

emulator @avd_name [ {-option [value]} … ]

27

emulator @avd_name [ {-option [value]} … ]

28 The cache partition image, which appears as

emulator @avd_name [ {-option [value]} … ]

29 in the emulated system. It's empty when you first create an AVD or use the

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

2 option. It stores temporary download files and is populated by the download manager and sometimes the system. For example, the browser uses it to cache downloaded web pages and images while the emulator is running. When you power off the virtual device, the file is deleted. You can persist the file by using the

emulator @avd_name [ {-option [value]} … ]

31 option.

emulator @avd_name [ {-option [value]} … ]

31

emulator @avd_name [ {-option [value]} … ]

33

(Optional) An SD card partition image that lets you simulate an SD card on a virtual device. You can create an SD card image file in the AVD Manager or using the

emulator @avd_name [ {-option [value]} … ]

34 tool. The file is stored on your development computer and must be loaded at startup.

When defining an AVD in the AVD Manager, you can choose to use an automatically managed SD card file or a file that you created with the

emulator @avd_name [ {-option [value]} … ]

35 tool. You can view the

emulator @avd_name [ {-option [value]} … ]

33 file associated with an AVD in the AVD Manager. The

emulator @avd_name [ {-option [value]} … ]

37 option overrides the SD card file specified in the AVD.

You can browse, send files to, and copy and remove files from a simulated SD card by using the emulator UI or the utility while the virtual device is running. You can't remove a simulated SD card from a running virtual device.

To copy files to the SD card file before loading it, mount the image file as a loop device and then copy the files. Or, use a utility, such as the

emulator @avd_name [ {-option [value]} … ]

39 package, to copy the files directly to the image.

The emulator treats the file as a pool of bytes, so the SD card format doesn't matter.

The

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

2 option doesn't affect this file. If you want to clear the file, delete the file and then re-create it using the AVD Manager or the

emulator @avd_name [ {-option [value]} … ]

35 tool. Changing the size of the file also deletes the file and creates a new file.

emulator @avd_name [ {-option [value]} … ]

37

List directories and files used by the emulator

You can discover where files are located in two ways:

  • Use the emulator @avd_name [ {-option [value]} … ] 43 or emulator @avd_name [ {-option [value]} … ] 44 option when you start the emulator from the command line. Look at the output.
  • Use the

    emulator @Nexus_5X_API_23 -memory 2048 5 emulator @avd_name [ {-option [value]} … ] 46 command to list a default directory. For example:

    emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files.

Command-line startup options

This section lists options you can supply on the command line when you start the emulator.

Note: The Android Emulator is continually under development to make it more reliable. For status on the issues reported against various command-line options and to report bugs, see the Android Issue Tracker.

Commonly used options

The following table lists command-line startup options that you might use more often:

Table 3. Commonly used command-line options

Command-line option Description Quick Boot

emulator @avd_name [ {-option [value]} … ]

47 Performs a cold boot and saves the emulator state on exit.

emulator @avd_name [ {-option [value]} … ]

48 Performs a quick boot if possible, but does not save the emulator state on exit.

emulator @avd_name [ {-option [value]} … ]

49 Disables the Quick Boot feature completely and doesn't load or save the emulator state. Device Hardware

emulator @avd_name [ {-option [value]} … ]

50

emulator @avd_name [ {-option [value]} … ]

51 Sets the emulation mode for a camera facing back or front. This overrides any camera setting in the AVD.

emulator @avd_name [ {-option [value]} … ]

52 can be any of the following values:

  • emulator @avd_name [ {-option [value]} … ] 53 - The emulator simulates a camera in the software.
  • emulator @avd_name [ {-option [value]} … ] 54 - The emulator uses a webcam connected to your development computer, specified by number. For a list of webcams, use the emulator @avd_name [ {-option [value]} … ] 55 option. For example, emulator @avd_name [ {-option [value]} … ] 56.
  • emulator @avd_name [ {-option [value]} … ] 57 - Disables the camera in the virtual device.

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

emulator @avd_name [ {-option [value]} … ]

55 Lists the webcams on your development computer that are available for emulation. For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
In the example, the first

emulator @avd_name [ {-option [value]} … ]

56 is the name you use on the command line. The second

emulator @avd_name [ {-option [value]} … ]

56 is the name used by the OS on the development computer. The second name varies depending on the OS.

As of SDK Tools 25.2.4, the AVD name is required.

Disk images and memory

emulator @avd_name [ {-option [value]} … ]

61

Specifies the physical RAM size, from 128 to 4096 MBs. For example:

emulator @Nexus_5X_API_23 -memory 2048

This value overrides the AVD setting.

emulator @avd_name [ {-option [value]} … ]

62 Specifies the filename and path to an SD card partition image file. For example:

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

If the file isn't found, the emulator still launches, but without an SD card. The command returns a No SD Card Image warning.

If you don't specify this option, the default is

emulator @avd_name [ {-option [value]} … ]

33 in the data directory unless the AVD specifies something different. For details about emulated SD cards, see .

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

2 Deletes user data and copies data from the initial data file. This option clears the data for the virtual device and returns it to the same state as when it was first defined. All installed apps and settings are removed. For example:

emulator @Nexus_5X_API_23 -wipe-data

By default, the user data file is

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

1 and the initial data file is

emulator @avd_name [ {-option [value]} … ]

10. Both of these files reside in the data directory. The

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

2 option doesn't affect the

emulator @avd_name [ {-option [value]} … ]

33 file. For more information about user data, see the section called .

Debug

emulator @avd_name [ {-option [value]} … ]

69 Enables or disables the display of debug messages for one or more tags. Separate multiple tags by a space, comma, or column. For example:

emulator @avd_name [ {-option [value]} … ]

0

To disable a tag, place a dash (-) in front of it. For example, the following option displays all debug messages, except the ones related to network sockets and metrics:

emulator @avd_name [ {-option [value]} … ]

70

For a list of tags and descriptions, use the

emulator @avd_name [ {-option [value]} … ]

71 option. For example:

emulator @avd_name [ {-option [value]} … ]

1

You can define the default debug tags in the environment variable. Define the tags you want to use in a comma-delimited list. Here's an example that shows how to specify the

emulator @avd_name [ {-option [value]} … ]

73 and

emulator @avd_name [ {-option [value]} … ]

74 tags:

emulator @avd_name [ {-option [value]} … ]

2

It's equivalent to using:

emulator @avd_name [ {-option [value]} … ]

75

or

emulator @avd_name [ {-option [value]} … ]

76

emulator @avd_name [ {-option [value]} … ]

77

emulator @avd_name [ {-option [value]} … ]

78 Enables a specific debug message type. Use the

emulator @avd_name [ {-option [value]} … ]

79 form to disable a debug message type. For example:

emulator @avd_name [ {-option [value]} … ]

3

For a list of tags, use the

emulator @avd_name [ {-option [value]} … ]

80 command.

emulator @avd_name [ {-option [value]} … ]

81 Enables the display of Logcat messages for one or more tags and writes them to the terminal window. For example, the following command enables error messages from all components:

emulator @avd_name [ {-option [value]} … ]

4

emulator @avd_name [ {-option [value]} … ]

82 uses the same format as the

emulator @avd_name [ {-option [value]} … ]

83 command. Enter

emulator @avd_name [ {-option [value]} … ]

84 for more information. It's a list of space- or comma-separated log filters of the format

emulator @avd_name [ {-option [value]} … ]

85.

emulator @avd_name [ {-option [value]} … ]

86 is either a wildcard asterisk (

emulator @avd_name [ {-option [value]} … ]

  1. or a component name, such as

emulator @avd_name [ {-option [value]} … ]

88,

emulator @avd_name [ {-option [value]} … ]

89,

emulator @avd_name [ {-option [value]} … ]

90, or

emulator @avd_name [ {-option [value]} … ]

91.

emulator @avd_name [ {-option [value]} … ]

92 is one of these values:

  • emulator @avd_name [ {-option [value]} … ] 93 - verbose
  • emulator @avd_name [ {-option [value]} … ] 94 - debug
  • emulator @avd_name [ {-option [value]} … ] 95 - informative
  • emulator @avd_name [ {-option [value]} … ] 96 - warning log level
  • emulator @avd_name [ {-option [value]} … ] 97 - error
  • emulator @avd_name [ {-option [value]} … ] 98 - silent

The following example displays GSM component messages at the informative log level:

emulator @avd_name [ {-option [value]} … ]

5

If you don't supply the

emulator @avd_name [ {-option [value]} … ]

99 option on the command line, the emulator looks for the environment variable. If

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

00 is defined with a valid

emulator @avd_name [ {-option [value]} … ]

82 value and isn't empty, the emulator uses its value to enable Logcat output to the terminal by default. You can also redirect the same or other log messages to the terminal through

emulator @Nexus_5X_API_23 -memory 2048

8.

For more information about Logcat and

emulator @Nexus_5X_API_23 -memory 2048

8, see Logcat command-line tool, View and write logs with Logcat,

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

05 class, and .

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

06 Displays kernel debug messages in the terminal window. For example:

emulator @avd_name [ {-option [value]} … ]

6

One use of this option is to check that the boot process works correctly.

emulator @avd_name [ {-option [value]} … ]

43 Prints emulator initialization messages to the terminal window. For example:

emulator @avd_name [ {-option [value]} … ]

7

It displays which files and settings are actually selected when starting a virtual device defined in an AVD. This option is the same as specifying

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

08.

Network

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

09 Uses the specified DNS servers.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

10 is a comma-separated list of up to four DNS server names or IP addresses. For example:

emulator @avd_name [ {-option [value]} … ]

8

By default, the emulator tries to detect the DNS servers you're using and sets up special aliases in the emulated firewall network to allow the Android system to connect directly to the servers. Use the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

11 option to specify a different list of DNS servers.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

12 Makes all TCP connections through a specified HTTP/HTTPS proxy. If your emulator must access the internet through a proxy server, you can use this option or the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

13 environment variable to set up the appropriate redirection. For example:

emulator @avd_name [ {-option [value]} … ]

9

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

14 can be one of the following:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

15

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

16

The

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

17 prefix can be omitted.

If this option isn't supplied, the emulator looks up the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

13 environment variable and automatically uses any value matching the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

14 format. For more information, see .

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

20

Sets network latency emulation to one of the following

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

21 values in milliseconds:

  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 22 - GSM/CSD (min 150, max 550).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 23 - HSCSD (min 80, max 400).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 24 - GPRS (min 35, max 200).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 25 - EDGE/EGPRS (min 80, max 400).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 26 - UMTS/3G (min 35, max 200).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 27 - HSDPA (min 0, max 0).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 28 - LTE (min 0, max 0).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 29 - EVDO (min 0, max 0).
  • emulator @avd_name [ {-option [value]} … ] 57 - No latency, the default (min 0, max 0).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 31 - Specifies exact latency.
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 32 - Specifies individual minimum and maximum latencies.

For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

0

The emulator supports network throttling as well as higher connection latencies. You can define it either through the skin configuration or with the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

33 and

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

34 options.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

35 Disables network throttling. For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

1

This option is the same as specifying

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

36. These are the default values for these options.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

37

Sets the network speed emulation. Specifies the maximum network upload and download speeds with one of the following

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

38 values in kbps:

  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 22 - GSM/CSD (up: 14.4, down: 14.4).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 23 - HSCSD (up: 14.4, down: 57.6).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 24 - GPRS (up: 28.8, down: 57.6).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 25 - EDGE/EGPRS (up: 473.6, down: 473.6).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 26 - UMTS/3G (up: 384.0, down: 384.0).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 27 - HSDPA (up: 5760.0, down: 13,980.0).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 28 - LTE (up: 58,000, down: 173,000).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 29 - EVDO (up: 75,000, down: 280,000).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 47 - No limit, the default (up: 0.0, down: 0.0).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 31 - Specifies both upload and download speed.
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 49 - Specifies individual up and down speeds.

For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

2

The emulator supports network throttling as well as higher connection latencies. You can define it either through the skin configuration or with the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

33 and

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

34 options.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

52 Sets the TCP port number that's used for the console and

emulator @Nexus_5X_API_23 -memory 2048

8. For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

3

The default value is 5554 for the first virtual device instance running on the your machine. A virtual device normally occupies a pair of adjacent ports: a console port and an

emulator @Nexus_5X_API_23 -memory 2048

8 port. The console of the first virtual device running on a particular machine uses console port 5554 and

emulator @Nexus_5X_API_23 -memory 2048

8 port 5555. Subsequent instances use port numbers increasing by two. For example, 5556/5557, 5558/5559, and so on. The range is 5554 to 5682, allowing for 64 concurrent virtual devices.

The port assignments are often the same as specifying

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

56.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

57 must be free and is reserved for

emulator @Nexus_5X_API_23 -memory 2048

8. If any of the console or

emulator @Nexus_5X_API_23 -memory 2048

8 ports are already in use, the emulator won't start.

The

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

60 option reports which ports and serial number the virtual device is using and warns if there are any issues with the values you provided. In the emulator UI, you can see the console port number in the window title and view the

emulator @Nexus_5X_API_23 -memory 2048

8 port number by selecting Help > About.

Note that if the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

62 value is not even and is in the range 5554 to 5584, the virtual device will start but not be visible when you use the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

63 command, if the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

64 starts after the emulator. For this reason, we recommend using an even console port number.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

65 Sets the TCP ports used for the console and

emulator @Nexus_5X_API_23 -memory 2048

8. For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

4

The valid ports range is 5554 to 5682, allowing for 64 concurrent virtual devices. The

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

67 option reports which ports and serial number the emulator instance is using and warns if there are any issues with the values you provided.

We recommend using the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

68 option instead, where possible. The

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

67 option is available for network configurations that require special settings.

For more information about setting console and

emulator @Nexus_5X_API_23 -memory 2048

8 ports, see the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

68 option.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

72 Captures network packets and stores them in a file. For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

5

Use this option to begin capturing all network packets that are sent through the virtual Ethernet LAN of the emulator. Afterward, you can use a tool like Wireshark to analyze the traffic.

Note that this option captures all ethernet packets and isn't limited to TCP connections.

System

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

73 Configures emulator VM acceleration. For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

6

Accelerated emulation works for x86 and x86_64 system images only. On Linux, it relies on KVM. On Windows and Mac, it relies on an Intel CPU and Intel HAXM driver. This option is ignored if you're not emulating an x86 or x86_64 device.

Valid values for

emulator @avd_name [ {-option [value]} … ]

52 are:

  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 75 - Determines automatically if acceleration is supported and uses it when possible (default).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 76 - Disables acceleration entirely, which is primarily useful for debugging.
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 77 - Forces acceleration. If KVM or HAXM isn't installed or usable, the emulator won't start and prints an error message.

For more information, see Configure hardware acceleration for the Android Emulator.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

78 Checks whether a required hypervisor for emulator VM acceleration is installed (HAXM or KVM). For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

7

For more information, see .

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

79

Specifies the emulator engine:

  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 75 - Automatically selects an engine (default).
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 81 - Uses the older QEMU 1 engine.
  • /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full 82 - Uses the newer QEMU 2 engine.

For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

8

Auto-detection should choose the value that provides the best performance when emulating a particular AVD. Use the

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

83 option for debugging and comparison purposes only.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

84 Selects the GPU emulation mode. For example:

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

9

For more information, see .

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

85 Disables emulator VM acceleration when using an x86 or x86_64 system image. It's useful for debugging only and is the same as specifying

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

86. For example:

emulator -list-avds

0

For more information, see Configure hardware acceleration for the Android Emulator.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

87

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

88 Disables extended Java Native Interface (JNI) checks in the Android Dalvik or ART runtime. For example:

emulator -list-avds

1

When you start a virtual device, extended JNI checks are enabled by default. For more information, see JNI tips.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

89 Sets the Security-Enhanced Linux (SELinux) security module to either

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

90 or

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

91 mode on a Linux operating system. For example:

emulator -list-avds

2

By default, SELinux is in

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

92 mode, meaning the security policy is enforced.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

91 mode loads the SELinux policy but doesn't enforce it. This option only logs policy violations.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

90 mode disables kernel support for SELinux.

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

95

Sets the time zone for the virtual device to

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

96 instead of the host time zone. For example:

emulator -list-avds

3

By default, the emulator uses the time zone of your development computer. Use this option to specify a different time zone or if the automatic detection isn't working correctly. The

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

96 value must be in zoneinfo format, which is

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

98 or

/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full

99. For example:

  • emulator -list-avds 00
  • emulator -list-avds 01
  • emulator -list-avds 02

The specified time zone must be in the zoneinfo database.

emulator -list-avds

03 Displays the emulator version number. For example:

emulator -list-avds

4

Or

emulator -list-avds

5 UI

emulator -list-avds

04 Disables the boot animation during emulator startup for faster booting. For example:

emulator -list-avds

6

On slower computers, this option can significantly speed up the boot sequence.

emulator -list-avds

05 Sets emulated touch screen mode. For example:

emulator -list-avds

7

emulator @avd_name [ {-option [value]} … ]

52 can be any of the following values:

  • emulator -list-avds 07 - Emulates a touch screen (default).
  • emulator -list-avds 08 - Emulates a multi-touch screen.
  • emulator -list-avds 09 - Disables touch and multi-touch screen emulation.

Advanced options

The command-line startup options in the following table are available but not commonly used by the average app developer.

In the descriptions, the working directory is the current directory in the terminal where you're entering commands. For information about the AVD system directory and data directory and the files stored within them, see the section about .

Some of these options are appropriate for external app developers, and some of them are used primarily by platform developers. App developers create Android apps and run them on specific AVDs. Platform developers work on the Android system and run it inside the emulator with no pre-created AVD.

Table 4. Advanced command-line options

Advanced option Brief description

emulator -list-avds

10

Enables bootcharting with a timeout in seconds. Some Android system images have a modified init system that integrates a bootcharting facility. You can pass a bootcharting timeout period to the system with this option. If your init system doesn't have bootcharting activated, the option does nothing. This option is primarily useful to platform developers, not external app developers.

For example:

emulator -list-avds

8

emulator -list-avds

11

Specifies a cache partition image file. Provides a filename and an absolute path or a path relative to the data directory to set up a persistent cache file. If the file doesn't exist, the emulator creates it as an empty file.

For example:

emulator -list-avds

9

If you don't use this option, the default is a temporary file named

emulator @avd_name [ {-option [value]} … ]

28. For more information, see .

emulator -list-avds

13

Sets the cache partition size in MBs.

For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

0

If you don't specify this option, the default is 66 MB. Normally, most app developers don't need this option, unless they need to download very large files that are larger than the default cache. For more information about the cache file, see .

emulator -list-avds

14

Sets the user data partition image file. Provides a filename and an absolute path or a path relative to the working directory to set up a persistent user data file. If the file doesn't exist, the emulator creates an image from the default

emulator @avd_name [ {-option [value]} … ]

10 file, stores it in the filename you specified, and persists user data to it at shutdown.

For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

1

If you don't use this option, the default is a file named

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

1. For more information about the user data file, see .

emulator -list-avds

17

Specifies a data directory using an absolute path. For more information, see .

For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

2

emulator -list-avds

18

Uses the 32-bit emulator on 64-bit platforms. Occasionally, this option is useful for testing or debugging. For example, there was an issue where the emulator would sometimes not run on 64-bit Windows, but 32-bit did run. This option was helpful for performing comparisons to debug the issue. Here's an example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

3

emulator -list-avds

19

Gets help about about disk images. This option provides information relevant to both app and platform developers. For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

4

emulator -list-avds

20

Gets help about character

emulator -list-avds

21 specifications. A

emulator -list-avds

21 parameter is required by some emulator options. For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

5

emulator -list-avds

23

Gets help about disk images relevant to app developers. This option gets information about where the image files are located for an AVD created with the SDK tools. For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

6

emulator -list-avds

24

Gets help about disk images relevant to platform developers. For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

7

emulator -list-avds

25

emulator -list-avds

26

Specifies the initial version of the data partition. After wiping user data, the emulator copies the contents of the specified file to user data (by default, the

emulator @Nexus_5X_API_23 -sdcard C:/sd/sdcard.img

1 file) instead of using the default

emulator @avd_name [ {-option [value]} … ]

10 file as the initial version. Specifies the filename and an absolute path or a path relative to the working directory.

For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

8

If you don't specify a path, it places the file in the system directory. For more information, see .

emulator -list-avds

29

Uses a specific emulated kernel. If you don't specify a path, the emulator looks in the system directory.

Use the

emulator -list-avds

30 option to view kernel debug messages.

For example:

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

9

If you don't specify this option, the default is

emulator @avd_name [ {-option [value]} … ]

02. For more information, see .

emulator -list-avds

32

emulator -list-avds

33

Disables audio support for this virtual device. Some Linux and Windows computers have faulty audio drivers that cause different symptoms, such as preventing the emulator from starting. In this case, use this option to overcome the issue. Alternatively, you can use the

emulator -list-avds

34 environment variable to change the audio backend.

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

0

emulator -list-avds

35

emulator -list-avds

36

Starts the emulator without a cache partition. If you don't use this option, the default is a temporary file named

emulator @avd_name [ {-option [value]} … ]

28. This option is for platform developers only. For more information, see .

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

1

emulator @avd_name [ {-option [value]} … ]

49

Inhibits both the automatic load and save operations, causing the emulator to execute a full boot sequence and to lose its state when closed. It overrides the

emulator -list-avds

39 option.

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

2

emulator @avd_name [ {-option [value]} … ]

47

Prevents the emulator from loading the AVD state from snapshot storage. Performs a full boot.

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

3

emulator @avd_name [ {-option [value]} … ]

48

Prevents the emulator from saving the AVD state to snapshot storage on exit, meaning that all changes will be lost.

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

4

emulator -list-avds

42

Doesn't try to correct the AVD clock time immediately on snapshot restore. This option can be useful during testing as it avoids a sudden time jump. Time updates are still sent to the AVD about every 15 seconds.

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

5

emulator -list-avds

43

Starts the emulator without mounting a file to store or load state snapshots, forcing a full boot and disabling state snapshot functionality. This option overrides the

emulator -list-avds

44 and

emulator -list-avds

39 options.

For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

6

emulator -list-avds

46

Disables graphical window display on the emulator. This option is useful when running the emulator on servers that have no display. You can access the emulator through

emulator @Nexus_5X_API_23 -memory 2048

8 or the console. For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

7

emulator -list-avds

48

Specifies the system data partition size in MBs. For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

8

emulator -list-avds

49

Sets an Android system property in the emulator when it boots.

emulator @avd_name [ {-option [value]} … ]

16 must be a property name labeled as

emulator -list-avds

51 of at most 32 characters, without any spaces, and

emulator -list-avds

52 must be a string of at most 92 characters. For an example, see the

emulator -list-avds

53 file. You can specify several

emulator -list-avds

54 options on one command line. This option can be useful for debugging. For example:

emulator @Nexus_5X_API_23 -camera-back webcam0

9

emulator -list-avds

55 Passes arguments to the QEMU emulator software. Note that QEMU 1 and QEMU 2 can use different arguments. When using this option, make sure it's the last option specified, as all options after it are interpreted as QEMU-specific options. This option is quite advanced and should be used only by developers who are very familiar with QEMU and Android emulation.

emulator -list-avds

56

Displays

emulator -list-avds

57 help. For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
0

emulator -list-avds

58

Specifies a ramdisk boot image. Specifies the filename and an absolute path or a path relative to the working directory.

For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
1

If you don't use this option, the default is the

emulator @avd_name [ {-option [value]} … ]

05 file in the system directory. For more information, see .

emulator -list-avds

60

Reports the console port to a remote third party before starting emulation. It can be useful for an automated testing script.

emulator @avd_name [ {-option [value]} … ]

73 must use one of these formats:

  • emulator -list-avds 62
  • emulator -list-avds 63

For more information, use the

emulator -list-avds

64 option as described in the section about .

emulator -list-avds

65

Creates a root shell console on the current terminal. This option differs from the

emulator -list-avds

66 command in the following ways:

  • It creates a root shell that lets you modify many parts of the system.
  • It works even if the emulator -list-avds 67 in the emulated system is broken.
  • Press Control+C (or Command-C, on macOS) to stop the emulator instead of the shell.

For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
2

emulator -list-avds

68

Specifies the name of a snapshot within a snapshot storage file for automatic start and save operations.

Rather than executing a full boot sequence, the emulator can resume execution from an earlier state snapshot, which is usually significantly faster. When you supply this option, the emulator loads the snapshot of that name from the snapshot image and saves it back under the same name on exit.

If you don't use this option, the default is a full boot sequence. If the specified snapshot doesn't exist, the emulator performs a full boot sequence instead and performs a save operation.

See the

emulator -list-avds

44 option for information on specifying a snapshot storage file and the default file.

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
3

Remember that in the process of loading a snapshot, all contents of the system, user data, and SD card images are overwritten with the contents they held when the snapshot was made. Unless you save this information in a different snapshot, any changes since then are lost.

You can also create a snapshot from the emulator console by using the

emulator -list-avds

70 command. For more information, see Send Emulator console commands.

emulator -list-avds

71

Displays a list of available snapshots. This command prints a table of snapshots that are stored in the snapshot storage file that the emulator was started with, then exits. If you specify

emulator -list-avds

72 as well, this command prints a table of the snapshots stored in file.

For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
4

You can use the ID and TAG column values in the output as arguments for the

emulator -list-avds

39 option.

emulator -list-avds

74

Specifies a repository file that contains all state snapshots. All snapshots made during execution are saved in this file. Only snapshots in this file can be restored during the emulator run.

For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
5

If you don't specify this option, the default is

emulator -list-avds

75 in the data directory. If the specified file doesn't exist, the emulator will start, but without support for saving or loading state snapshots.

emulator -list-avds

76

Specifies a system directory using an absolute path. For more information, see . For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
6

emulator -list-avds

77

Specifies an initial system file. Provides the filename and an absolute path or a path relative to the working directory.

For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
7

If you don't use this option, the default is the

emulator @avd_name [ {-option [value]} … ]

06 file in the system directory. For more information, see .

emulator -list-avds

79

On Linux, uses the system

emulator -list-avds

80 instead of the version bundled with the emulator system. Use this option only if the emulator won't start normally, and note that it doesn't always work. Alternatively, set the environment variable to 1.

For example:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
8

emulator -list-avds

82

Use this option to have a writable system image during your emulation session. To do so:

  1. Start a virtual device with the emulator -list-avds 83 option.
  2. Enter the emulator -list-avds 84 command from a command terminal to tell the emulator to remount emulator -list-avds 85 as read/write. By default, it's mounted as read-only.

Using this flag creates a temporary copy of the system image that can be very large, up to several hundred MBs, but will be destroyed when the emulator exits.

Deprecated options

The following command-line options are deprecated:

  • emulator -list-avds 86
  • emulator -list-avds 87
  • emulator -list-avds 88
  • emulator -list-avds 89
  • emulator -list-avds 90
  • emulator -list-avds 91
  • emulator -list-avds 92
  • emulator -list-avds 93
  • emulator -list-avds 94
  • emulator -list-avds 95
  • emulator -list-avds 96
  • emulator -list-avds 97
  • emulator -list-avds 98
  • emulator -list-avds 99
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 00
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 01
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 02
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 03
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 04
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 05
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 06
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 07
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 08
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 09
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 10
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 11
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 12
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 13
  • emulator -help-datadir Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:
      /Users/me/.android  
    
    See '-help-disk-images' for more information about disk image files. 14

Get help about command-line options

This section describes how to get help about the command-line options. It provides more in-depth information about the commonly used emulator command-line options that are available when you start the emulator.

List all emulator options

To print a list of all emulator options, including a short description, enter the following command:

emulator @Nexus_5X_API_23 -webcam-list

    List of web cameras connected to the computer:
    Camera 'webcam0' is connected to device 'webcam0'
    on channel 0 using pixel format 'UYVY'
9

Get detailed help for a specific option

To print help for a specific startup option, enter the following command:

emulator @Nexus_5X_API_23 -memory 2048

0

For example:

emulator @Nexus_5X_API_23 -memory 2048

1

This help is more detailed than the description provided by the

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

15 option.

Get detailed help for all options

To get detailed help for all emulator options, enter the following command:

emulator @Nexus_5X_API_23 -memory 2048

2

List emulator environment variables

To get a list of emulator environment variables, enter the following command:

emulator @Nexus_5X_API_23 -memory 2048

3

You can set environment variables in the terminal window before launching a virtual device, or you can set it through your user settings in the operating system. For example, set it in your

emulator @Nexus_5X_API_23 -memory 2048

7 file on Linux.

List debug tags

To print a list of tags for the

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

17 options, enter the following command:

emulator @Nexus_5X_API_23 -memory 2048

4

The

emulator -help-datadir

Use '-datadir <dir>' to specify a directory where writable image files will be searched. On this system, the default directory is:

  /Users/me/.android
See '-help-disk-images' for more information about disk image files.

17 options let you enable or disable debug messages from specific emulator components, as specified by the tags.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2023-04-12 UTC.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]