The code should check to see if the emulator is ready instead of sleeping a static amount.

```bash
# http://ncona.com/2014/01/detect-when-android-emulator-is-ready/
svc_bootanim=''
while [[ 'stopped' != ${svc_bootanim:0:7} ]]; do
  sleep 3
  svc_bootanim=`adb shell getprop init.svc.bootanim`
  adb kill-server; adb devices
done
```