Created
September 22, 2016 09:55
Workaround adb disconnecting issue on macOS Sierra
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
#!/bin/bash | |
cat << EOF | |
########################################################### | |
# Workaround adb disconnecting issue on macOS Sierra | |
# | |
# More info: | |
# https://code.google.com/p/android/issues/detail?id=219085 | |
# credits to: hans...@meetme.com, vs...@google.com | |
########################################################### | |
EOF | |
function monitor_adb () { | |
adb start-server | |
echo "[$(date)] adb started" | |
while [ "$(adb shell echo 1)" ]; do sleep 5; done | |
echo "[$(date)] adb is broken, restarting" | |
adb kill-server | |
adb start-server || adb start-server | |
adb reverse tcp:8081 tcp:8081 | |
} | |
while [ true ]; do time monitor_adb ; done |
Fix for multiple connected devices: https://gist.github.com/steverichey/df147bc118d34dadb2f1dfedb82e864b
how to close this services? thks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this!
One caveat: doesn't work if more than one device is connected.