adb-reverse
Forward ports from Android device to host
TLDR
List all reverse socket connections from emulators and devices
Reverse a TCP port from the only connected emulator or device to localhost
Reverse a TCP port from a specific emulator or device (by device ID / [s]erial number) to localhost
Remove a reverse socket connection from an emulator or device
Remove all reverse socket connections from all emulators and devices
SYNOPSIS
adb reverse [--list | --remove-all | --remove <local> | --no-rebind] [<local>] [<remote>]
PARAMETERS
--list
List all current reverse forwards from device to host
--remove-all
Remove all reverse socket connections
--remove <local>
Remove specific reverse forward by local spec (e.g., tcp:8080)
--no-rebind
Fail if port is already forwarded (don't rebind)
<local>
Local address:port on device (e.g., tcp:8080, localabstract:/path)
<remote>
Remote address:port on host (e.g., tcp:8080)
DESCRIPTION
The adb reverse command enables reverse port forwarding from an Android device to the host machine. Unlike standard adb forward, which forwards host ports to the device, adb reverse allows services running on the device (e.g., a web server or debug server) to be accessed from the host.
This is particularly useful for development scenarios where the device lacks direct network access to the host, such as Wi-Fi debugging, testing device-hosted APIs, or exposing device sockets. For example, running a local HTTP server on the device at port 8080 can be made accessible at localhost:8080 on the host.
It supports TCP transports primarily, with syntax like tcp:8080. The forwarding persists until explicitly removed or ADB restarts. Requires Android 5.0+ (API 21), USB debugging enabled, and an authorized device. Works over USB or TCP/IP connections.
CAVEATS
Requires Android 5.0+; only TCP widely supported; forwards lost on ADB restart or device reboot; host firewall may block access; use --no-rebind to avoid overwriting existing forwards.
EXAMPLES
Setup: adb reverse tcp:8080 tcp:8080
List: adb reverse --list
Remove: adb reverse --remove tcp:8080
Remove all: adb reverse --remove-all
HISTORY
Introduced in Android SDK tools r25.2.3 (2015) with Android 5.0 Lollipop for Wi-Fi debugging and reverse tethering support. Enhanced in later ADB versions for stability over TCP/IP.


