Skip to content

Instantly share code, notes, and snippets.

@mikehardy
Last active August 31, 2018 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikehardy/d7d76a5f2e162093ba1913dab50c4235 to your computer and use it in GitHub Desktop.
Save mikehardy/d7d76a5f2e162093ba1913dab50c4235 to your computer and use it in GitHub Desktop.
Android emulator fleet management - startup
#!/bin/bash
for AVD in `emulator -list-avds`; do
echo -n Found $AVD...
SDCARD="/tmp/$AVD-sdcard.img"
NORMAL_ARGS="-no-boot-anim -sdcard $SDCARD"
EXTRA_ARGS=""
case "$AVD" in
*OLD*)
# Name your emulators with an "OLD" tag for API <=17 or sdcard doesn't auto-mount
echo "$AVD is old, using workaround..."
EXTRA_ARGS="$EXTRA_ARGS -engine classic"
;;
*NEW*)
# Name your emulators with a "NEW" tag for API >17
echo "$AVD is new, normal emulator..."
;;
*ARM*)
# Don't use ARM emulators by default on x86 (so slow...)
echo "Skipping ARM emulator $AVD..."
continue
;;
*Chromebook*)
# Don't use Chromebook emulators by default
echo "Skipping Chromebook emulator $AVD..."
continue
;;
esac
$ANDROID_SDK/tools/mksdcard -l sdcard 100M $SDCARD
$ANDROID_SDK/emulator/emulator $NORMAL_ARGS $EXTRA_ARGS @$AVD &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment