diff --git a/contrib/instrumentation.sh b/contrib/instrumentation.sh index bb40a6f22..b77fea836 100644 --- a/contrib/instrumentation.sh +++ b/contrib/instrumentation.sh @@ -2,9 +2,21 @@ adb logcat -c adb logcat *:E -v color & -if ./gradlew jacocoInstrumentationTestReport; then - echo "jacocoInstrumentationTestReport succeeded" >&2 -else - adb exec-out screencap -p >screencap.png - exit 1 -fi +retry=0 +while [ $retry -le 3 ] +do + if ./gradlew jacocoInstrumentationTestReport; then + echo "jacocoInstrumentationTestReport succeeded" >&2 + break + else + adb kill-server + adb start-server + adb logcat -c + ./gradlew clean + retry=$(( $retry + 1 )) + if [ $retry == 3 ]; then + adb exec-out screencap -p >screencap.png + exit 1 + fi + fi +done