alexcmgit

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

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

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

Usage becomes:

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):

nano ~/.zshrc

bash:

nano ~/.bashrc

Paste the function, save, then reload:

source ~/.zshrc

or

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 setup described in how to find your Android SDK path on macOS, Windows and Ubuntu.

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:

emulator -avd 31 -no-snapshot-load

you run:

e 31

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

Other posts

you reached the end
CC BY-NC-SA 4.0 v35865c4 2021-2026 @alexcmgit