Skip to content

Instantly share code, notes, and snippets.

Created June 16, 2017 11:00
Show Gist options
  • Save anonymous/614aafb2d8710865c688684a8657a141 to your computer and use it in GitHub Desktop.
Save anonymous/614aafb2d8710865c688684a8657a141 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set +e
bootanim=""
failcounter=0
timeout_in_sec=500
until [[ "$bootanim" =~ "stopped" ]]; do
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &`
echo "$bootanim"
if [[ "$bootanim" =~ "not found"
|| "$bootanim" =~ "device not found"
|| "$bootanim" =~ "no emulators found"
|| "$bootanim" =~ "device offline"
|| "$bootanim" =~ "running" ]]; then
let "failcounter += 5"
echo "Waiting for emulator to start"
if [[ $failcounter -gt timeout_in_sec ]]; then
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
jobs -l
exit 1
fi
fi
sleep 5
done
echo "Emulator is ready!"
exit 0
#!/usr/bin/env bash
for ((PORT=5554; PORT<=5584; PORT+=2)); do
echo killing emulator-$PORT...
adb -s emulator-$PORT emu kill || true
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment