Skip to content

Instantly share code, notes, and snippets.

@dant3
Last active September 9, 2015 09:37
Show Gist options
  • Save dant3/663c72ddd3f84a58790a to your computer and use it in GitHub Desktop.
Save dant3/663c72ddd3f84a58790a to your computer and use it in GitHub Desktop.
ADB over wifi
#!/bin/bash
PORT=5555
echo "Getting device ip..."
PHONE_IP=`adb shell ip -f inet addr show wlan0 | grep inet | cut -d: -f2 | awk '{ print $2 }' | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"`
echo "Device ip: $PHONE_IP"
echo "Enabling adb tcpip on port $PORT"
adb tcpip $PORT
echo "adb tcpip enabled. Connecting..."
adb connect $PHONE_IP:$PORT
echo "Adb over wifi connected. Now you can remove your usb cable."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment