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 target Android device or emulator.
port
The TCP port number on which the ADB daemon on the device is listening. The default and commonly used port for ADB is 5555.
DESCRIPTION
The `adb connect` command establishes a network connection from your development machine to an Android device or emulator over TCP/IP, enabling wireless debugging. This is particularly useful when a physical USB connection is inconvenient or impossible, for instance, when testing on multiple devices simultaneously or when the device is mounted in an inaccessible location. Before using `adb connect`, the target Android device must first be configured for TCP/IP debugging, typically by enabling Developer Options and then switching ADB from USB to TCP/IP mode using `adb tcpip port` (often 5555) while still connected via USB. Once connected, all standard `adb` commands (like `adb install`, `adb shell`, `adb logcat`) can be used wirelessly. The connection persists until explicitly disconnected with `adb disconnect` or until the device reboots.
CAVEATS
The target Android device must have Developer Options enabled and USB debugging activated.
Before connecting via `adb connect`, the device's ADB daemon must be switched to TCP/IP mode, typically done via `adb tcpip port` while it's still connected via USB.
Both the development machine and the Android device must be on the same network and be able to communicate with each other (e.g., no firewall blocking the specified port).
The device's IP address might change if it's using DHCP, requiring reconnection.
Some devices or custom ROMs might have additional security measures or require specific settings to allow wireless ADB.
DISCONNECTING
To disconnect from a wirelessly connected device, use `adb disconnect host:port` to disconnect from a specific device, or simply `adb disconnect` to disconnect from all active network connections.
DEFAULT PORT
The standard port for ADB connections is 5555. If no port is specified in the `adb tcpip` command on the device, it defaults to 5555, which means `adb connect host:5555` is often the correct syntax.
USING WITH EMULATORS
`adb connect` can also be used to connect to Android emulators running on the same machine or a remote machine, typically using `localhost` or the remote machine's IP, along with the emulator's specific ADB port (e.g., 5554, 5556, etc.).
HISTORY
The Android Debug Bridge (ADB) has been a core component of the Android SDK since its early days, providing developers with a versatile tool for interacting with Android devices. The ability to connect via TCP/IP, including the `adb connect` command, was introduced early in ADB's development to facilitate wireless debugging, recognizing the convenience and flexibility it offers compared to a solely USB-based connection. This feature has remained largely consistent in its functionality and syntax, adapting to evolving Android versions and network environments while maintaining its foundational role in Android development workflows.