A tiny shell function to launch Android emulators fast

I like keeping emulator names minimal. Instead of long device names, I create AVDs using only the API level as the name, like 31, 30, 34. That turns emulator startup into a very small command.

The function

Bash
e() {
  if [ -z "$1" ]; then
    echo "Usage: e <AVD_NAME>"
    return 1
  fi

  emulator -avd "$1" -no-snapshot-load
}

Usage becomes:

Bash
e 31
e 34

This boots the selected emulator with a clean state by skipping snapshot restore.

Why name AVDs by API level?

For development and testing, the API version is usually what matters most. Naming devices numerically makes switching environments extremely fast and easy to remember.

Examples:

  • 30 → Android 11
  • 31 → Android 12
  • 34 → Android 14

No mental overhead, no autocomplete needed.

Installing

Add the function to your shell configuration.

zsh (default shell on modern macOS):

Bash
nano ~/.zshrc

bash:

Bash
nano ~/.bashrc

Paste the function, save, then reload:

Bash
source ~/.zshrc

or

Bash
source ~/.bashrc

Requirements

The Android emulator CLI must already be available in your PATH. If you still need to configure your SDK location, follow the Android SDK Path setup.

macOS and Linux compatibility

This works the same on macOS and Linux. The function is just standard shell syntax calling the emulator binary, so behavior is identical as long as the Android SDK tools are installed.

Result

Instead of typing:

Bash
emulator -avd 31 -no-snapshot-load

you run:

Bash
e 31

One small alias, much less friction when jumping between API levels.