Skip to content

Instantly share code, notes, and snippets.

@michael-martinez
Last active July 21, 2020 12:54
Show Gist options
  • Save michael-martinez/53ec323e32c066ef775ad28805713277 to your computer and use it in GitHub Desktop.
Save michael-martinez/53ec323e32c066ef775ad28805713277 to your computer and use it in GitHub Desktop.
Configures Android adb to work over Wifi
#!/bin/bash
echo 'Please ensure that you enabled Developer Mode on Android device.'
read -p "Press any key to confirm..."
echo 'Please ensure that you enabled Usb Debugging on Android device.'
read -p "Press any key to confirm..."
echo 'Please ensure that your device is connected to computer through USB.'
read -p "Press any key to confirm..."
IP_ADDRESS=$1
PORT=5555
if [ -z "$IP_ADDRESS" ]
then
IP_ADDRESS=$(adb shell ifconfig |grep inet |tail -1 | sed "s/inet addr://g" |
sed "s/ Mask:255.0.0.0//g" | sed -e 's/^[[:space:]]*//')
fi
echo 'Connecting to '$IP_ADDRESS' using adb over Wifi...'
adb kill-server
adb tcpip $PORT
adb connect $IP_ADDRESS:$PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment