Wireless ADB Debugging over Android Hotspot

When developing on the go, you often use your Android phone as a mobile hotspot for your laptop. But Android disables native Wireless Debugging on the device acting as the hotspot host. Without a workaround, you either need a second phone or stay tethered by a short USB cable.

By running adb tcpip 5555 once over USB, you configure the phone to listen for ADB connections on its gateway IP address (usually 192.168.43.1). Once established, the wireless connection stays active for hours across development sessions. You only need a USB cable once every few days after a phone reboot.

Setup

  1. Connect your phone via USB and turn on its Hotspot.
  2. Enable TCP mode on port 5555:
    adb tcpip 5555
    
  3. Unplug the USB cable and connect over the hotspot gateway IP:
    # Find gateway IP on macOS
    GATEWAY_IP=$(route -n get default | grep gateway | awk '{print $2}')
    adb connect $GATEWAY_IP:5555
    

Automation Script

To avoid running these commands manually, save this script as adb_hotspot_connect.sh:

#!/usr/bin/env bash
set -e

# Find gateway IP (the hotspot device)
GATEWAY_IP=$(route -n get default | grep gateway | awk '{print $2}')

if [ -z "$GATEWAY_IP" ]; then
  echo "Error: Could not determine gateway IP. Are you connected to your hotspot?"
  exit 1
fi

echo "Connecting to $GATEWAY_IP:5555..."
if adb connect "$GATEWAY_IP:5555" | grep -q "connected"; then
  echo "Successfully connected wirelessly."
  adb devices
  exit 0
fi

# Fallback if phone was rebooted
read -p "Connection failed. Is USB connected to initialize TCP mode? (y/n): " confirm
if [[ $confirm == [yY] ]]; then
  adb tcpip 5555
  sleep 2
  adb connect "$GATEWAY_IP:5555"
  adb devices
fi

Make it executable:

chmod +x adb_hotspot_connect.sh

Whenever you start work, run ./adb_hotspot_connect.sh to ensure your phone appears in adb devices.