How do I disable a port forwarding rule in adb that was previously enabled with
adb forward tcp:1234 tcp:1234
Is there any other way than killing and restarting the adb server?
Try adb forward --remove tcp:8080, or adb forward --remove-all.
This was added to adb in December 2012
Setting Up Redirection through ADB
The Android Debug Bridge (ADB) tool provides port forwarding, an alternate way for you to set up network redirection. For more information, see Forwarding Ports in the ADB documentation.
You can also remove a redirection by killing the ADB server.
However you can use network redirection provided by emulator console, which provide ways of removing. To access type:
telnet localhost emulator_port
usually first emulator runs on port 5554.
use command "rdir" to add, del or list network redirections.
See documentation in Using Network Redirection.
Good luck.
EDIT:
To stop forwarding use
adb forward --remove tcp:<port>
, or adb forward --remove-all
.
This was added to adb in December 2012 (see patch here). The SDK update released for Android 4.3 (API 18) was the first to support it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With