Linux command
adb-forward 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Forward
adb forward tcp:[8080] tcp:[8080]
Example
adb forward tcp:[8080] localabstract:[socket_name]
List
adb forward --list
Remove
adb forward --remove tcp:[8080]
Example
adb forward --remove-all
Example
adb -s [serial] forward tcp:[8080] tcp:[8080]
说明
adb forward sets up port forwarding from a local port on your computer to a port on the connected Android device. This enables connecting to services running on the device as if they were running locally. Common uses include debugging apps with remote debuggers, accessing development servers running on the device, or connecting to app-specific sockets.
参数
- tcp:_port_
- TCP port number. Remote may be "tcp:0" to pick any open port.
- localabstract:_name_
- Unix domain socket in abstract namespace.
- localreserved:_name_
- Unix domain socket in reserved namespace.
- localfilesystem:_name_
- Unix domain socket in filesystem namespace.
- jdwp:_pid_
- JDWP (Java Debug Wire Protocol) for process ID.
- vsock:_CID:port_
- vsock address (CID and port).
- --no-rebind
- Fail if local port is already forwarded
- --list
- List all active port forwards
- --remove _local_
- Remove specific forward rule
- --remove-all
- Remove all forward rules
FAQ
What is the adb-forward command used for?
adb forward sets up port forwarding from a local port on your computer to a port on the connected Android device. This enables connecting to services running on the device as if they were running locally. Common uses include debugging apps with remote debuggers, accessing development servers running on the device, or connecting to app-specific sockets.
How do I run a basic adb-forward example?
Run `adb forward tcp:[8080] tcp:[8080]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does tcp:_port_ do in adb-forward?
TCP port number. Remote may be "tcp:0" to pick any open port.