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
e() {
if [ -z "$1" ]; then
echo "Usage: e <AVD_NAME>"
return 1
fi
emulator -avd "$1" -no-snapshot-load
}Usage becomes:
e 31
e 34This 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 1131→ Android 1234→ Android 14
No mental overhead, no autocomplete needed.
Installing
Add the function to your shell configuration.
zsh (default shell on modern macOS):
nano ~/.zshrcbash:
nano ~/.bashrcPaste the function, save, then reload:
source ~/.zshrcor
source ~/.bashrcRequirements
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:
emulator -avd 31 -no-snapshot-loadyou run:
e 31One small alias, much less friction when jumping between API levels.