Created
December 28, 2015 10:26
-
-
Save dagezi/43024663e0a2223b8862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def waitForEmulatorReady() { | |
def bootanim = '' | |
def failCounter = 0 | |
while (!(bootanim =~ /stopped/)) { | |
def adbProcess = 'adb -e shell getprop init.svc.bootanim'.execute() | |
def errCode = adbProcess.waitFor() | |
if (errCode != 0) { | |
failCounter += 1 | |
if (failCounter > 3) { | |
throw new RuntimeException('failed to start emulator') | |
} | |
} | |
bootanim = adbProcess.text | |
println bootanim | |
sleep(1000) | |
} | |
} | |
android.testVariants.all { variant -> | |
variant.connectedInstrumentTest.doFirst { | |
waitForEmulatorReady() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment