Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Workaround adb disconnecting issue on macOS Sierra
#!/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
@neurofluid

This comment has been minimized.

Copy link

@neurofluid neurofluid commented Sep 26, 2016

Thank you for this!

One caveat: doesn't work if more than one device is connected.

@steverichey

This comment has been minimized.

Copy link

@steverichey steverichey commented Sep 27, 2016

@471448446

This comment has been minimized.

Copy link

@471448446 471448446 commented Sep 29, 2016

how to close this services? thks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.