When starting up the emulator, adb shell getprop dev.bootcomplete will sometimes hang indefinitely. This will cause the entire job to hang. Below is a log w/ timestamps where I have a 15 minute build timeout kick in.
Since adb is prone to hanging, every adb command (or at least these first ones) should have a watchdog thread killing them if they take too long.
I'm guessing an adb disconnect/connect combo after the hanging command might be needed too.
08:17:35 Building on master
08:17:35 [android] Using Android SDK: /usr/local/android
08:17:35 $ /usr/local/android/tools/emulator -snapshot-list -no-window -avd hudson_en-US_160_WVGA_android-4
08:17:35 [android] Starting Android emulator from snapshot
08:17:35 $ /usr/local/android/tools/emulator -no-boot-anim -ports 47225,56719 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-4 -snapshot jenkins -no-snapshot-save -no-window
08:17:35 emulator: warning: opening audio output failed
08:17:40 $ /usr/local/android/platform-tools/adb connect emu:47225,56719
08:17:40 $ /usr/local/android/platform-tools/adb -s emulator-47225 logcat -v time
08:17:40 [android] Waiting for emulator to finish booting...
08:17:40 $ /usr/local/android/platform-tools/adb -s emulator-47225 shell getprop dev.bootcomplete
08:32:35 Build timed out (after 15 minutes). Marking the build as aborted.
08:32:35 [android] Interrupted while waiting for emulator to finish booting.
08:32:35 [android] Timed-out after waiting 120 seconds for emulator
08:32:35 [android] Stopping Android emulator
08:32:35 [android] Archiving emulator log
08:32:35 Notifying upstream projects of job completion
08:32:35 Finished: NOT_BUILT