Skip to content

Instantly share code, notes, and snippets.

@hidroh
Last active May 6, 2024 02:31
Show Gist options
  • Save hidroh/67b2ee7bbdd9038450c00d8a4d69c3fa to your computer and use it in GitHub Desktop.
Save hidroh/67b2ee7bbdd9038450c00d8a4d69c3fa to your computer and use it in GitHub Desktop.
Handy bash script to prompt for an Android virtual device (AVD) selection and launch it. Assuming that Android SDK has been set up and is in user PATH.
emulator -list-avds | cat -n
printf "Select AVD: "
read index
avd=$(emulator -list-avds | sed "${index}q;d")
echo "Selected $avd"
emulator -netdelay none -netspeed full -avd $avd
@ricardopereira
Copy link

ricardopereira commented Nov 16, 2023

I was facing an issue while running the script: "Could not launch '/Users/<redacted>/Library/Android/sdk/tools/../emulator/qemu/darwin-x86_64/qemu-system-aarch64': No such file or directory". I'm using macOS.

Then I found out that recent versions of the Android SDK, the emulator tool has been moved out of the tools directory to its own emulator directory at the same level as tools. I had to modify the script to navigate to ${ANDROID_HOME}/emulator instead of ${ANDROID_HOME}/tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment