Start the emulator from the command line

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

This page describes command-line features that you can use with theAndroid Emulator.For information about using the Android Emulator UI, seeRun Apps on the Android Emulator.

Starting the emulator

Use the emulator command to start the emulator, as analternative to runningyour project or startingit through the AVD Manager.

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

  1. emulator -avd avd_name [ {-option [value]} ]

Or

  1. emulator @avd_name [ {-option [value]} ]

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

  1. $ /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 lateron.

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

  1. emulator -list-avds

When you use this option, it displays a list of AVD names from your Android homedirectory. Note that you can override the default home directory by setting theANDROID_SDK_HOMEenvironment variable: the root of theuser-specific directory where all configuration and AVD content is stored. Youcould set the environment variable in the terminal window before launching avirtual device, or you could set it through your user settings in the operatingsystem; for example, in your .bashrc file on Linux.

To stop the Android Emulator, just close the emulator window.

Installing an app

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

To install an app by using adb, and then run and test the app,follow these general steps:

  • Build and package your app into an APK as described in Build and Run YourApp.
  • Start the emulator from the command line as described in the previoussection, using any startup options necessary.
  • Install your app using adb.
  • Run and test your app on the emulator.While the emulator isrunning, you can also use the EmulatorConsole to issue commands as needed.
  • The virtual device preserves the app and its state data across restarts,in a user-data disk partition (userdata-qemu.img). To clear thisdata, start the emulator with the -wipe-data option or wipe thedata in the AVD Manager, for example. For more information about the user-datapartition and other storage, see the following section.To uninstall an app, doso as you would on an Android device.

Note: The adb utility sees the virtual device asan actual physical device. For this reason, you might have to use the-d flag with some common adb commands, such asinstall. The -d flag lets you specify which of severalconnected devices to use as the target of a command. If you don't specify-d, the emulator targets the first device in its list.

Understanding the default directories and files

The emulator uses associated files, of which the AVD system and data directoriesare the most important. It helps to understand the emulator directory structureand files when specifying command-line options. Although, you normally don'tneed to modify the default directories or files.

The Android Emulator uses the Quick Emulator (QEMU) hypervisor. Initial versions of theAndroid 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 usesto simulate the operating system. It has platform-specific, read-only filesshared by all AVDs of the same type, including API level, CPU architecture, andAndroid variant. The default locations are the following:

  • Mac OS X and Linux - ~/Library/Android/sdk/system-images/android-apiLevel/variant/arch/
  • Microsoft Windows XP - C:\Documents and
    Settings\user\Library\Android\sdk\system-images\android-apiLevel\variant\arch
    \
  • Windows Vista - C:\Users\user\Library\Android\sdk\system-images\android-apiLevel\variant\arch\
    Where:

  • apiLevel is a numeric API level, or a letter forpreview releases. For example, android-M indicated the AndroidMarshmallow preview. On release, it became API level 23, designated byandroid-23.

  • variant is a name corresponding to specific featuresimplemented by the system image; for example, google_apis orandroid-wear.
  • arch is the target CPU architecture; for example,x86.
    Use the -sysdir option to specify a different system directory forthe AVD.

The emulator reads the following files from the system directory.

FileDescriptionOption to Specify a Different File
kernel-qemu or kernel-ranchu The binary kernel image for the AVD. kernel-ranchu is theQEMU 2 emulator, the latest version. -kernel
system.img The read-only initial version of the system image; specifically, thepartition containing the system libraries and data corresponding the API leveland variant. -system
ramdisk.img The boot partition image. This is a subset of system.imgthat's loaded by the kernel initially before the system image is mounted. Ittypically contains just a few binaries and initialization scripts. -ramdisk
userdata.img The _initial _version of the data partition, which appears asdata/ in the emulated system and contains all writable data for theAVD. The emulator uses this file when you create a new AVD or use the‑wipe-data option. For more information, see theuserdata-qemu.img file description in the following section. -initdata-init-data

AVD data directory

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

The default location is the following, where name is theAVD name:

  • Mac OS X and Linux - ~/.android/avd/name.avd/
  • Microsoft Windows XP - C:\Documents and
    Settings\user.android\name.avd\
  • Windows Vista, and higher -C:\Users\user.android\name.avd\
    Use the -datadir option to specify a different AVD data directory.

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

FileDescriptionOption to Specify a Different File
userdata-qemu.img
The content of the data partition, which appears as data/ inthe emulated system. When you create a new AVD, or when you use the-wipe-data option to reset the AVD to the factory defaults, theemulator copies the userdata.img file in the system directory tocreate this file.

Each virtual device instance uses a writable user-data image to store user- andsession-specific data. For example, it uses the image to store a unique user'sinstalled app data, settings, databases, and files. Each user has adifferent ANDROID_SDK_HOME directory that stores the data directories for theAVDs created by that user; each AVD has a single userdata-qemu.imgfile.
-data
cache.img The cache partition image, which appears as cache/ in theemulated system. It's empty when you first create an AVD or use the-wipe-data option. It stores temporary download files and ispopulated by the download manager and sometimes the system; for example, thebrowser uses it to cache downloaded web pages and images while the emulator isrunning. When you power off the virtual device, the file is deleted. You canpersist the file by using the -cache option. -cache
sdcard.img
(Optional) An SD card partition image that lets you simulate an SD cardon a virtual device. You can create an SD card image file in the AVDManager or using the mksdcardtool. The file is stored on your development computer and must be loaded atstartup.

When defining an AVD in the AVD Manager, you have the choiceto use an automatically managed SD card file, or a file that you created withthe mksdcard tool. You can view the sdcard.img fileassociated with an AVD in the AVD Manager. The -sdcard optionoverrides the SD card file specified in the AVD.

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

To copy files to the SD card file before loading it, you can mount the imagefile as a loop device and then copy the files. Or use a utility such as themtools 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'tmatter.

Note that the -wipe-data option doesn't affect this file. If youwant to clear the file, you need to delete the file and then recreate it usingthe AVD Manager or the mksdcard tool. Changing the size of the filealso deletes the file and creates a new file.
-sdcard

Listing directories and files used by the emulator

You can discover where files are located in two ways:

  • When you start the emulator from the command line, use the-verbose or -debug init option, and look at theoutput.
  • Use the emulator -help-option command tolist a default directory. For example:
  1. $ emulator -help-datadir
  2. Use '-datadir <dir>' to specify a directory where writable image files
  3. will be searched. On this system, the default directory is:
  4.  
  5. /Users/me/.android
  6.  
  7. 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 theemulator.

Note: The Android Emulator is continually under development tomake 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.

Command-Line OptionDescription
Quick Boot
-no-snapshot-load Performs a cold boot, and saves the emulator state on exit.
-no-snapshot-save Performs a quick boot if possible, but does not save the emulator state on exit.
-no-snapshot Disables the Quick Boot feature completely—it does not load or save the emulator state.
Device Hardware
-camera-back mode-camera-front
mode
Set the emulation mode for a camera facing back or front. It overridesany camera setting in the AVD.
mode can be any of the following values:

- emulated - The emulator simulates a camera in the software.
- webcamn - The emulator uses a webcam connected to yourdevelopment computer, specified by number. For a list of webcams, use the -webcam-listoption; for example, webcam0.
- none - Disable the camera in the virtual device.
For example:


  1. $ emulator @Nexus5X_API_23 -camera-back webcam0


-webcam-list List the web cameras on your development computer that are available foremulation. For example:

  1. $ 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 webcam0 is the name you use on thecommand line. The second webcam0 is the name used by the OS on thedevelopment computer. The second name varies depending on the OS.

As of SDK Tools 25.2.4, the AVD name is required, although it might not be inthe future.
_Disk Images and Memory
-memory size Specify the physical RAM size from 128 to 4096 MBs. For example:



  1. $ emulator @Nexus5X_API_23 -memory 2048


This value overrides the AVD setting.
-sdcard filepath Specify the filename and path to an SD card partition image file. Forexample:



  1. $ 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 sdcard.imgin the data directory (unless the AVD specifies something different).For details about emulated SD cards, see AVD data directory.
-wipe-data Delete user data and copy data from the initial data file. This optionclears the data for the virtual device and returns it to the same state as whenit was first defined. All installed apps and settings are removed. For example:



  1. $ emulator @Nexus_5X_API_23 -wipe-data


By default, the user data file is userdata-qemu.img and the initialdata file is userdata.img, both residing in the data directory.The -wipe-data option doesn't affect the sdcard.imgfile. For more information about user data, see Understanding thedefault directories and files.
_Debug
-debug tags Enable or disable the display of debug messages for one or more tags.Separate multiple tags by a space, comma, or column. For example:



  1. $ emulator @Nexus5X_API_23 -debug init,metrics


To disable a tag, place a dash (-) in front of it; for example, the followingoption displays all debug messages, except the ones related to network socketsand metrics:

-debug all,-socket,-metrics

For a list of tags and descriptions, use the -help-debug-tagsoption. For example:




  1. $ emulator -help-debug-tags


You can define the default debug tags in the ANDROID_VERBOSEenvironment variable. Define the tags you want to use in a comma-delimited list.Here's an example showing it defined with the socket andgles tags:




  1. ANDROID_VERBOSE=socket,gles


It's equivalent to using:

-debug-socket -debug-gles
-debug-tag-debug-no-tag Enable a specific debug message type. Use the no form todisable a debug message type. For example:



  1. $ emulator @Nexus_5X_API_23 -debug-all -debug-no-metrics


For a list of tags, use the emulator -help-debug-tags command.
-logcat logtags Enable the display of logcat messages for one or more tags, and writethem to the terminal window. For example, the following command enables errormessages from all components:



  1. $ emulator @Nexus_5X_API_23 -logcat :e


logtags uses the same format as the adb logcat
logtags
command (enter adb logcat -help for moreinformation). It's a list of space- or comma-separated log filters of the formatcomponentName:logLevel.componentNameis either a wildcard asterisk (
) or a component name, such asActivityManager, SystemServer, InputManager, WindowManager, and soon.logLevel is one of these values:

- v - verbose
- d - debug
- i - informative
- w - warning log level
- e - error
- s - silent
The following example displays GSM component messages at the informativelog level:




  1. $ emulator @Nexus_5X_API_23 -logcat '*:s GSM:i'


If you don't supply the -logcat option on the command line, theemulator looks for the ANDROID_LOG_TAGS environment variable. If ANDROID_LOG_TAGS is defined with a validlogtags value and isn't empty, the emulator uses its valueto enable logcat output to the terminal by default. You can also redirect thesame, or other, log messages to the terminal through adb.For moreinformation about logcat and adb, see logcatCommand-Line Tool, Write and ViewLogs with Logcat, Logclass, and adbcommands reference.
-show-kernel Display kernel debug messages in the terminal window. For example:



  1. $ emulator @Nexus_5X_API_23 -show-kernel


One use of this option is to check that the boot process works correctly.
-verbose Print emulator initialization messages to the terminal window. Forexample:



  1. $ emulator @Nexus_5X_API_23 -verbose


It displays which files and settings are actually selected when starting avirtual device defined in an AVD. This option is the same as specifying-debug-init.
_Network
-dns-server servers Use the specified DNS servers. servers is acomma-separated list of up to four DNS server names or IP addresses. Forexample:

  1. $ emulator @Nexus5X_API_23 -dns-server 192.0.2.0,192.0.2.255


By default, the emulator tries to detect the DNS servers you're using and setsup special aliases in the emulated firewall network to allow the Android systemto connect directly to them. Use the -dns-server option to specifya different list of DNS servers.
-http-proxy proxy Make all TCP connections through a specified HTTP/HTTPS proxy. If youremulator must access the internet through a proxy server, you can use thisoption or the http_proxy environment variable to set up theappropriate redirection. For example:



  1. $ emulator @Nexus_5X_API_23 -http-proxy myserver:1981


proxy can be one of thefollowing:http://server:porthttp://username:password@server:port

Thehttp:// prefix can be omitted.

If this option isn't supplied, the emulator looks up the http_proxyenvironment variable and automatically uses any value matching theproxy format.For more information, see Usingthe emulator with a proxy.
-netdelay delay
Set network latency emulation to one of the following delay values in milliseconds:

- gsm - GSM/CSD (min 150, max 550).
- hscsd - HSCSD (min 80, max 400).
- gprs - GPRS (min 35, max 200).
- edge - EDGE/EGPRS (min 80, max 400).
- umts - UMTS/3G (min 35, max 200).
- hsdpa - HSDPA (min 0, max 0).
- lte - LTE (min 0, max 0).
- evdo - EVDO (min 0, max 0).
- none - No latency, the default (min 0, max 0).
- num - Specify exact latency.
- min:max - Specify individual minimum andmaximum latencies.
For example:


  1. $ emulator @Nexus_5X_API_23 -netdelay gsm


The emulator supports network throttling (limiting the maximum networkbandwidth, also called network shaping) as well as higher connection latencies.You can define it either through the skin configuration, or with the‑netspeed and -netdelay options.
-netfast Disable network throttling. For example:



  1. $ emulator @Nexus_5X_API_23 -netfast


This option is the same as specifying -netspeed full -netdelay
none
. These are the default values for these options.
-netspeed speed
Set the network speed emulation. Specify the maximum network upload anddownload speeds with one of the following speed values inkbps:

- gsm - GSM/CSD (up: 14.4, down: 14.4).
- hscsd - HSCSD (up: 14.4, down: 57.6).
- gprs - GPRS (up: 28.8, down: 57.6).
- edge - EDGE/EGPRS (up: 473.6, down: 473.6).
- umts - UMTS/3G (up: 384.0, down: 384.0).
- hsdpa - HSDPA (up: 5760.0, down: 13,980.0).
- lte - LTE (up: 58,000, down: 173,000).
- evdo - EVDO (up: 75,000, down: 280,000).
- full - No limit, the default (up: 0.0, down: 0.0).
- num - Specify both upload and download speed.
- up:down - Specify individual up and downspeeds.
For example:


  1. $ emulator @Nexus_5X_API_23 -netspeed edge


The emulator supports network throttling (limiting the maximum networkbandwidth, also called network shaping) as well as higher connection latencies.You can define it either through the skin configuration, or with the‑netspeed and -netdelay options.
-port port Set the TCP port number that's used for the console and adb. For example:



  1. $ emulator @Nexus_5X_API_23 -port 5556


The default value is 5554 for the first virtual device instance running on theyour machine. A virtual device normally occupies a pair of adjacent ports: aconsole port and an adb port. The console of the first virtual device running ona particular machine uses console port 5554 and adb port 5555. Subsequentinstances use port numbers increasing by two — for example, 5556/5557,5558/5559, and so on. The range is 5554 to 5682, allowing for 64 concurrentvirtual devices.

The port assignments are often the same as specifying -ports
port,{port + 1}
. {port + 1} mustbe free and will be reserved for adb. If any of the console or adb ports isalready in use, the emulator won't start.The ‑port optionreports which ports and serial number the virtual device is using, and warns ifthere are any issues with the values you provided. In the emulator UI, you cansee the console port number in the window title, and you can view the adb portnumber by selecting Help > About.

Note that if the port value is not even and is in therange 5554 to 5584, the virtual device will start but not be visible when youuse the adb devices command if the adb server starts _after_the emulator. For this reason, we recommend using an even console port number.
-ports
console-port,adb-port
Set the TCP ports used for the console and adb. For example:



  1. $ emulator @Nexus_5X_API_23 -ports 5556,5559


The valid ports range is 5554 to 5682, allowing for 64 concurrent virtualdevices. The -ports option reports which ports and serial numberthe emulator instance is using, and warns if there are any issues with thevalues you provided.

We recommend using the -port option instead, where possible. The-ports option is available for network configurations that requirespecial settings.

For more information about setting console and adb ports, see the-port option.
-tcpdump filepath Capture network packets and store them in a file. For example:



  1. $ emulator @Nexus_5X_API_23 -tcpdump /path/dumpfile.cap


Use the option to begin capturing all network packets that are sent through thevirtual Ethernet LAN of the emulator. After, you can use a tool like Wiresharkto analyze the traffic.

Note that this option captures all Ethernet packets, and isn't limited to TCPconnections.
_System
-accel mode Configure emulator VM acceleration. For example:



  1. $ emulator @Nexus5X_API_23 -accel auto


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

Valid values for mode are:

- auto - Determine automatically if acceleration is supported anduse it when possible (default).
- off - Disables acceleration entirely, which is primarily usefulfor debugging.
- on - Force acceleration. If KVM or HAXM isn't installed orusable, the emulator won't start and prints an error message.
For more information, see ConfigureHardware Acceleration.
-accel-check Check whether a required hypervisor for emulator VM acceleration isinstalled (HAXM or KVM). For example:



  1. $ emulator -accel-check


For more information, see Determiningwhether HAXM or KVM is installed.
-engine engine
Specify the emulator engine:

- auto - Automatically select an engine (default).
- classic - Use the older QEMU 1 engine.
- qemu2 - Use the newer QEMU 2 engine.
For example:




  1. $ emulator @Nexus_5X_API_23 -engine auto


Auto-detection should choose the value that provides the best performance whenemulating a particular AVD. You should use the -engine option fordebugging and comparison purposes only.
-gpu mode Select the GPU emulation mode. For example:



  1. $ emulator @Nexus_5X_API_23 -gpu swiftshader_indirect


For more information, see Configuringgraphics acceleration on the command line.
-no-accel
Disable emulator VM acceleration when using an x86 or x86_64 systemimage. It's useful for debugging only and is the same as specifying -accel
off
. For example:



  1. $ emulator @Nexus_5X_API_23 -no-accel


For more information, see ConfigureHardware Acceleration.
-nojni-no-jni Disable extended Java Native Interface (JNI) checks in the Android Dalvikor ART runtime. For example:



  1. $ emulator @Nexus_5X_API_23 -nojni


When you start a virtual device, extended JNI checks are enabled by default. Formore information, see JNITips.
-selinux {disabled|permissive} Set the Security-Enhanced Linux (SELinux)security module to either disabled or permissive mode on a Linux operatingsystem. For example:



  1. me-linux$ emulator @Nexus_5X_API_23 -selinux permissive


By default, SELinux is in enforcing mode, meaning the security policy isenforced. permissive mode loads the SELinux policy, but doesn'tenforce it; it just logs policy violations. disabled mode disableskernel support for SELinux.
-timezone timezone
Set the timezone for the virtual device totimezone, instead of the host timezone. Forexample:


  1. $ emulator @Nexus_5X_API_23 -timezone Europe/Paris


By default, the emulator uses the timezone of your development computer. Usethis option to specify a different timezone or if the automatic detection isn'tworking correctly. The timezone value must be in zoneinfoformat, which is area/location orarea/subarea/location. For example:

- America/Los_Angeles
- Europe/Paris
- America/Argentina/Buenos_Aires
The specified timezone must be in the zoneinfo database.
-version Display the emulator version number. For example:



  1. $ emulator @Nexus_5X_API_23 -version


Or




  1. $ emulator -version


_UI
-no-boot-anim Disable the boot animation during emulator startup for faster booting.For example:



  1. $ emulator @Nexus_5X_API_23 -no-boot-anim


On slower computers, this option can significantly speed up the boot sequence.
-screen mode Set emulated touch screen mode. For example:



  1. $ emulator @Nexus_5X_API_23 -screen no-touch


mode can be any of the following values:

- touch - Emulate a touch screen (default).
- multi-touch - Emulate a multi-touch screen.
- no-touch - Disable touch and multi-touch screenemulation.

Advanced options

The following command-line startup options are available, but not commonly used by the average appdeveloper.

In the descriptions, the working directory is the current directory inthe terminal where you're entering commands. For information about the AVDsystem directory and data directory, and the files storedwithin them, see Understanding thedefault directories and files.

Some of these options are appropriate for external app developers, and some ofthem are used primarily by platform developers. App developers createAndroid apps and run them on specific AVDs. Platform developers work onthe Android system and run it inside the emulator with no pre-created AVD;they're internal Android team members, not external app developers.

Advanced OptionBrief Description
-bootchart timeout
Enable bootcharting, with a timeout in seconds. Some Android systemimages have a modified init system that integrates a bootcharting facility. You can pass abootcharting timeout period to the system with this option. If your init systemdoesn't have bootcharting activated, the option does nothing. This option isprimarily useful to platform developers, not external app developers.

For example:


  1. $ emulator @Nexus5X_API_23 -bootchart 120


-cache filepath
Specify a cache partition image file. Provide a filename, and an absolutepath or a path relative to the data directory, to set up a persistent cachefile. If the file doesn't exist, the emulator creates it as an empty file. Ifyou don't use this option, the default is a temporary file namedcache.img. For more information, see AVD datadirectory.

For example:


  1. $ emulator @Nexus_5X_API_23 -cache
    ~/.android/avd/Nexus_5X_API_23.avd/cache_persistent.img


-cache-size size
Set the cache partition size in MBs. If you don'tspecify 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 defaultcache. For more information about the cachefile, see AVD data directory.

For example:


  1. $ emulator @Nexus_5X_API_23 -cache-size 1000


-data filepath
Set the user data partition image file. Provide a filename, and anabsolute path or a path relative to the working directory, to set up apersistent user data file. If the file doesn't exist, the emulator creates animage from the default userdata.img file, stores it in the filenameyou specified, and persists user data to it at shutdown. If you don't use thisoption, the default is a file named userdata-qemu.img. For moreinformation about the user data file, see AVD datadirectory.

For example:


  1. $ emulator @Nexus_5X_API_23 -data
    ~/.android/avd/Nexus_5X_API_23.avd/userdata-test.img


-datadir dir
Specify a data directory using an absolute path. For more information,see AVD data directory.

For example:


  1. $ emulator @Nexus_5X_API_23 -datadir
    ~/.android/avd/Nexus_5X_API_23.avd/mytest


-force-32bit
Use the 32-bit emulator on 64-bit platforms. Occasionally, this option isuseful for testing or debugging. For example, there was an issue where theemulator would sometimes not run on 64-bit Windows, but 32-bit did run; thisoption was helpful for performing comparisons to debug the issue. Here's anexample:


  1. $ emulator @Nexus_5X_API_23 -force-32bit


-help-disk-images
Get help about about disk images. It provides information relevant toboth app and platform developers. For example:


  1. $ emulator -help-disk-images


-help-char-devices
Get help about character device specifications. Adevice parameter is required by some emulator options.For example:


  1. $ emulator -help-char-devices


-help-sdk-images
Get help about disk images relevant to app developers. It explains wherethe image files are located for an AVD created with the SDK tools. For example:


  1. $ emulator -help-sdk-images


-help-build-images
Get help about disk images relevant to platform developers. For example:


  1. $ emulator -help-build-images


-initdata filepath-init-data
filepath

Specify the _initial version of the data partition. After wipinguser data, the emulator copies the contents of the specified file to userdata (by default, the userdata-qemu.img file) instead of using thedefault userdata.img file as the initial version. Specify thefilename, and an absolute path or a path relative to the working directory. Ifyou don't specify a path, it places the file in the system directory. For moreinformation, see AVD system directory.

For example:


  1. $ emulator @Nexus5X_API_23 -initdata
    ~/Library/Android/sdk/system-images/android-23/google_apis/x86/userdata-test.img


-kernel filepath
Use a specific emulated kernel. If you don't specify a path, the emulatorlooks in the system directory. If you don't specify this option, the default iskernel-ranchu. For more information, see AVD system directory. Use the‑show‑kernel option to view kernel debug messages.

For example:


  1. $ emulator @Nexus_5X_API_23 -kernel
    ~/Library/Android/sdk/system-images/android-23/google_apis/x86/kernel-test.img
    -show-kernel


-noaudio-no-audio
Disable audio support for this virtual device. Some Linux and Windowscomputers have faulty audio drivers that cause different symptoms, such aspreventing the emulator from starting. In this case, you can use this option toovercome the issue. Alternatively, you can use the QEMU_AUDIO_DRVenvironment variable to change the audio backend.

For example:


  1. $ emulator @Nexus_5X_API_23 -noaudio


-nocache-no-cache
Start the emulator without a cache partition. If you don't use thisoption, the default is a temporary file named cache.img. Thisoption is for platform developers only. For more information, see AVD data directory.

For example:


  1. $ emulator @Nexus_5X_API_23 -nocache


-no-snapshot
Inhibit both the automatic load and save operations, causing the emulatorto execute a full boot sequence and to lose its state when closed. It overridesthe -snapshot option.

For example:


  1. $ emulator @Nexus_5X_API_23 -no-snapshot


-no-snapshot-load
Prevent the emulator from loading the AVD state from snapshot storage.Perform a full boot.

For example:


  1. $ emulator @Nexus_5X_API_23 -no-snapshot-load


-no-snapshot-save
Prevent the emulator from saving the AVD state to snapshot storage onexit, meaning that all changes will be lost.

For example:


  1. $ emulator @Nexus_5X_API_23 -no-snapshot-save


-no-snapshot-update-time
Don'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, however.

For example:


  1. $ emulator @Nexus_5X_API_23 -no-snapshot-update-time


-no-snapstorage
Start the emulator without mounting a file to store or load statesnapshots, forcing a full boot and disabling state snapshot functionality. Thisoption overrides the -snapstorage and -snapshotoptions.

For example:


  1. $ emulator @Nexus_5X_API_23 -no-snapstorage


-no-window
Disable graphical window display on the emulator. This option is usefulwhen running the emulator on servers that have no display. You'll still beable to access the emulator through adb or the console. For example:


  1. $ emulator @Nexus_5X_API_23 -no-window


-partition-size size
Specify the system data partition size in MBs. For example:


  1. $ emulator @Nexus_5X_API_23 -partition-size 1024


-prop name=value
Set an Android system property in the emulator when it boots.name must be a property name of at most 32 characters,without any spaces in it, and value must be a string of atmost 92 characters. You can specify several ‑prop options on onecommand line. This option can be useful for debugging.For example:


  1. $ emulator @Nexus_5X_API_23 -prop status.battery.level_raw=80
    -prop ro.serialno=123456


-qemu args Pass arguments to the QEMU emulator software. Note that QEMU 1 and QEMU 2can use different arguments. When using this option, make sure it's the lastoption specified, as all options after it are interpreted as QEMU-specificoptions. This option is quite advanced and should be used only by developers whoare _very familiar with QEMU and Android emulation.
-qemu -h
Display -qemu help. For example:


  1. $ emulator -qemu -h


-ramdisk filepath
Specify a ramdisk boot image. Specify the filename, and an absolute pathor a path relative to the working directory. If you don't use this option, thedefault is the ramdisk.img file in the system directory. For moreinformation, see AVD system directory.

For example:


  1. $ emulator @Nexus5X_API_23 -ramdisk
    ~/Library/Android/sdk/system-images/android-23/google_apis/x86/ramdisk-test.img


-report-console socket
Report the console port to a remote third party before startingemulation. It can be useful for an automated testing script.socket must use one of theseformats:

- tcp:port[,server][,max=seconds][,ipv6]
- unix:port[,server][,max=seconds][,ipv6]
For more information, use the -help-report-console option as described inGetting detailed help for a specific option.
-shell
Create a root shell console on the current terminal. It differs from theadb
shell
command in the following ways:

- It creates a _root shell that allows you to modify many parts of thesystem.
- It works even if the adb daemon in the emulated system is broken.
- Pressing Ctrl+C (⌘C) stops the emulator, instead of the shell.
For example:


  1. $ emulator @Nexus_5X_API_23 -shell


-snapshot name
Specify 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 -snapstorage option for information on specifying a snapshot storage file and the default file.


  1. $ emulator @Nexus_5X_API_23 -snapshot snapshot2


It’s important to 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 theavd snapshot save name command. For more information, seeSend Emulator Console Commands to a Virtual Device.
-snapshot-list
Display a list of available snapshots. It prints a table of snapshots that are stored in the snapshot storage file that the emulator was started with, then exits. If you specify -snapstorage file as well, this command prints a table of the snapshots stored in file.

For example:


  1. $ emulator @Nexus_5X_API_23 -snapshot-list -snapstorage
    ~/.android/avd/Nexus_5X_API_23.avd/snapshots-test.img


You can use the ID and TAG column values in the outputas arguments for the -snapshot option.
-snapstorage filepath
Specify a repository file that contains all state snapshots. All snapshots made during execution will be saved in this file, and only snapshots in this file can be restored during the emulator run. If you don’t specify this option, the default is snapshots.img in the data directory. If the specified file doesn’t exist, the emulator will start, but without support for saving or loading state snapshots.

For example:


  1. $ emulator @Nexus_5X_API_23 -snapstorage
    ~/.android/avd/Nexus_5X_API_23.avd/snapshots-test.img


-sysdir dir
Specify a system directory using an absolute path. For more information,see AVD system directory.For example:


  1. $ emulator @Nexus_5X_API_23 -sysdir
    ~/Library/Android/sdk/system-images/android-23/google_apis/x86/test


-system filepath
Specify an initial system file. Provide the filename, and an absolute pathor a path relative to the working directory. If you don't use this option, thedefault is the system.img file in the system directory. For moreinformation, see AVD system directory. Forexample:


  1. $ emulator @Nexus_5X_API_23 -system
    ~/Library/Android/sdk/system-images/android-23/google_apis/x86/system-test.img


-use-system-libs
On Linux, use the system libstdc++ instead of the version bundled with the emulator system. Use this option only if the emulator won’t start normally, although it doesn’t always work. Alternatively, set the ANDROID_EMULATOR_USE_SYSTEM_LIBS environment variable to 1.

For example:


  1. me-linux$ emulator @Nexus_5X_API_23 -use-system-libs


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

- Start a virtual device with the -writable-system option.
- Enter the adb remount command from a command terminal to tell the emulator to remount system/ as read/write (it’s mounted as read-only by default).
Note that using this flag will create a temporary copy of the system image that can be very large (several hundred MBs), but will be destroyed when the emulator exits.

Deprecated options

The following command-line options are deprecated:

  • -audio-in
  • -audio-out
  • -charmap
  • -code-profile
  • -cpu-delay
  • -dpi-device
  • -dynamic_skin
  • -enable-kvm
  • -gps
  • -image
  • -keyset
  • -help-keys
  • -help-keyset-file
  • -nand-limits
  • -noskin
  • -no-skin
  • -onion
  • -onion-alpha
  • -onion-rotation
  • -radio
  • -ranchu
  • -raw-keys
  • -scale
  • -shared-net-id
  • -shell-serial
  • -skin
  • -skindir
  • -trace
  • -useaudio

Getting help about command-line options

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

Listing all emulator options

To print a list of all emulator options, including a short description, enterthis command:

  1. emulator -help

Getting detailed help for a specific option

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

  1. emulator -help-option

For example:

  1. emulator -help-netspeed

This help is more detailed than the description provided by the-help option.

Getting detailed help for all options

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

  1. emulator -help-all

Listing emulator environment variables

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

  1. emulator -help-environment

You can set environment variables in the terminal window before launching avirtual device, or you could set it through your user settings in the operatingsystem; for example, in your .bashrc file on Linux.

Listing debug tags

To print a list of tags for the -debug options, enter this command:

  1. emulator -help-debug-tags

The -debug options let you enable or disable debug messages fromspecific emulator components, as specified by the tags.