Last active
December 30, 2025 15:57
-
-
Save SuggonM/82c983a8b408019d2d1211ffa3aecef0 to your computer and use it in GitHub Desktop.
Restart wireless debugging (ADB) in port 5555 with Termux (no root)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/data/data/com.termux/files/usr/bin/bash | |
| termux-notification --id 1 -t "Scanning for ADB port..." | |
| adb_port=$(nmap -sT -p30000-50000 --open localhost | grep -m1 -oP "^\d+") | |
| if [[ -z $adb_port ]]; then | |
| termux-notification --id 1 -t "No debug port detected" -c "Tap to rescan." --action "$(realpath $0)" | |
| exit | |
| fi | |
| termux-notification --id 1 -t "ADB port detected: $adb_port. Restarting ADB..." | |
| adb connect localhost:$adb_port | |
| adb -s localhost:$adb_port tcpip 5555 | |
| adb kill-server | |
| termux-notification --id 1 -t "Successfully restarted ADB in port 5555" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment