Install android-tools if you haven't already:
pkg update ; pkg upgrade
pkg install android-tools
adb pair 127.0.0.1:port
Where port is taken from the menu shown after clicking from
Developer options > Wireless debugging > Pair device with pairing code. Use splitscreen to show theWireless debuggingsetting below the Termux app when pairing.
After pairing successfully, run the following commands to either connect or disconnect:
adb connect 127.0.0.1:port
adb disconnect
Where port is shown in the
Wireless debuggingmenu asIP address & Port.
After you're done with adb, make sure to close the daemon:
adb kill-server




This is absolutely Google’s fault.
I just run
adb tcpip $myFavoritePortafter boot, and it stays on that port until reboot.With Termux, I can even run that command right in Termux and don’t have to connect via USB nor enter the port manually at all, to set it back to
$myFavoritePort. (You need to pair to127.0.0.1:$googlesRandomPortvia entering a pairing code before doing it the first time.)