LinuxCommandLibrary

emulator

Run Android emulator instances

TLDR

Start an Android emulator device

$ emulator -avd [name]
copy

Display the webcams on your development computer that are available for emulation
$ emulator -avd [name] -webcam-list
copy

Start an emulator overriding the facing back camera setting (use -camera-front for front camera)
$ emulator -avd [name] -camera-back [none|emulated|webcamN]
copy

Start an emulator, with a maximum network speed
$ emulator -avd [name] -netspeed [gsm|hscsd|gprs|edge|hsdpa|lte|evdo|full]
copy

Start an emulator with network latency
$ emulator -avd [name] -netdelay [gsm|hscsd|gprs|edge|hsdpa|lte|evdo|none]
copy

Start an emulator, making all TCP connections through a specified HTTP/HTTPS proxy (port number is required)
$ emulator -avd [name] -http-proxy [http://example.com:80]
copy

Start an emulator with a given SD card partition image file
$ emulator -avd [name] -sdcard [path/to/sdcard.img]
copy

Display help
$ emulator -help
copy

SYNOPSIS

emulator [-avd avd-name] [emulator-options] [adb-options]

PARAMETERS

-avd
    Launch specific Android Virtual Device by name

-no-snapshot-load
    Start fresh without loading snapshot

-wipe-data
    Delete user data and start clean

-no-window
    Run headless (no UI window)

-gpu
    Graphics mode: host, guest, swiftshader_indirect, angle_indirect, off

-memory
    Set guest RAM size in MB

-partition-size
    Resize internal storage partition

-sdcard
    Path to SD card image file

-netdelay
    Network delay emulation: none, gsm, hsdpa

-netspeed
    Network speed: full, gprs, edge, umts

-dns-server
    Custom DNS server IP

-http-proxy
    HTTP/HTTPS proxy settings

-accestoken
    Google APIs access token file

-help
    Display full help and options

-list-avds
    List available AVD names

DESCRIPTION

The emulator command, part of the Android SDK Platform-Tools, starts the Android Emulator to simulate Android devices on Linux, macOS, or Windows.

It enables app testing without physical hardware by running a virtual Android device (AVD). Developers create AVDs using avdmanager, specifying CPU, RAM, screen size, and Android version.

Key capabilities include GPU acceleration for smooth graphics (via KVM on Linux), snapshot save/restore for quick sessions, multi-touch emulation, GPS simulation, battery/network control, and telephony support.

Basic usage: emulator -avd My_AVD_Name. Advanced options allow partitioning SD cards, wiping data, or running headless.

On Linux, enable hardware acceleration with KVM for best performance; requires libvirt and nested virtualization if in VM. Integrates with adb for app deployment and debugging.

Ideal for CI/CD pipelines or resource-constrained setups, though slower than real devices for some workloads.

CAVEATS

Requires Android SDK/emulator package; KVM setup mandatory for acceleration on Linux (<sudo apt install qemu-kvm libvirt-daemon-system>); high CPU/RAM usage; no root access by default; snapshots incompatible across emulator versions.

PREREQUISITES

Install Android SDK Command-Line Tools; add $ANDROID_SDK/emulator and $ANDROID_SDK/platform-tools to PATH; create AVD via avdmanager create avd -n MyAVD -k "system-images;android-34;google_apis;x86_64".

PERFORMANCE TIPS

Use -gpu host with KVM; enable nested virt if in VM; allocate 4+ GB RAM; prefer x86_64 images over ARM for speed.

HISTORY

Introduced in Android SDK r01 (2008) using custom virtualization; switched to QEMU-based in 2011 (Ice Cream Sandwich); added KVM/HAXM in 2013; x86 emulation via Intel HAXM/goldfish kernel; modern versions (30+) support ARM images, Wear OS, foldables, and Vulkan graphics.

SEE ALSO

avdmanager(1), adb(1), qemu-system-x86_64(1)

Copied to clipboard