Home » Android » ADB Commands » adb forward

adb forward

The adb forward command is used to set up forwardings, allowing you to forward communications from one port on your local machine to another port on the Android device or emulator. This is commonly used for debugging purposes, allowing you to access services running on the device or emulator from your development machine.

Here is the basic syntax of the adb forward command:

$ adb forward <local> <remote>
  • <local>: The local port on your development machine.
  • <remote>: The remote port on the Android device or emulator.

For example, to forward the local port 8080 to the remote port 8888, you would use:

$ adb forward tcp:8080 tcp:8888

Now, any communication to localhost:8080 on your development machine will be forwarded to localhost:8888 on the Android device.

To list all current forwardings, you can use:

$ adb forward --list

To remove a forwarding, you can use:

$ adb forward --remove <local>

Replace <local> with the local port number you want to remove.

Forwarding is often used in conjunction with tools like adb reverse to manage the flow of communication between your development machine and the Android device or emulator during the development and debugging process.

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment