adb-connect
Connect to Android device over network
TLDR
Pair with an Android device (address and pairing code can be found in developer options)
Connect to an Android device (port will be different from pairing)
Disconnect a device
SYNOPSIS
adb connect host[:port]
PARAMETERS
host
The IP address or hostname of the Android device or emulator.
port
The port number to connect to on the device. Defaults to 5555 if not specified.
DESCRIPTION
The `adb connect` command facilitates establishing a connection to an Android device or emulator over TCP/IP. This is particularly useful for debugging and development purposes when a direct USB connection isn't feasible or desirable.
Instead of connecting through a USB cable, you can connect to a device wirelessly via the Android Debug Bridge (ADB). You need to know the device's IP address and ensure the device is listening for connections on port 5555 (or another configured port). The command initiates a TCP connection to the specified IP address and port, allowing you to use ADB commands as if the device were connected via USB.
For devices that aren't already listening on port 5555, you must first connect via USB and issue the `adb tcpip 5555` command. After issuing this command the device can be disconnected from USB and the connection can continue over TCP/IP.
CAVEATS
The device or emulator must be accessible over the network. A firewall may prevent the connection. On the device itself you need to enable debugging. Connecting over TCP/IP can be less reliable than USB.
USAGE EXAMPLE
To connect to a device with IP address 192.168.1.100 on the default port (5555):adb connect 192.168.1.100
To connect to a device with IP address 192.168.1.100 on port 5556:adb connect 192.168.1.100:5556
TROUBLESHOOTING
If the connection fails, verify the following:
- The device is on the same network as your computer.
- The device is listening on the specified port (usually 5555).
- No firewall is blocking the connection.
- You have authorized the connection on the device (a prompt may appear on the device screen).
- Use adb kill-server to reset ADB server
HISTORY
The `adb connect` command is part of the Android Debug Bridge (ADB), which has been developed by Google as part of the Android SDK. It's been an essential tool for Android developers since the early days of the platform, enabling debugging and testing on both physical devices and emulators. The ability to connect over TCP/IP has been invaluable for remote development and automated testing.