Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.