Last active
October 3, 2018 12:13
-
-
Save MacRusher/7ece5990c0c4548e2acdec144576d35e to your computer and use it in GitHub Desktop.
Enable remote debugging on android device via ADB over TCP/IP
This file contains hidden or 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
#!/usr/bin/env bash | |
# List current devices before operation for convenience | |
# There must be only one device connected or operation will fail | |
adb devices | |
# Listen on TCP port | |
adb tcpip 5555 | |
# Connection may fail operation if done too early, so wait for a while | |
sleep 5; | |
# Find out local ip address (this may differ based on network card etc.) and connect via TCP/IP | |
adb connect $(adb shell ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'):5555 | |
# Done, you can now unplug usb cable and adb will still work |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on Ubuntu.
You probably want to change network interface name (
wlan0
in my case).Run
ifconfig
for more details.Usage:
Connected to xx.xx.xx.xx:5555
.