Skip to main content

Run ADB commands on your phone without a computer: Termux + ADB Wi-Fi wireless debugging

·
Categories Smartphones Termux Tutorials
Tags Android Debug Bridge
Table of Contents

This article only applies to devices running Android 11 or later. For devices below Android 11, please obediently use a computer for ADB debugging.

ADB (Android Debug Bridge) is a tool for debugging phones. Without root privileges, it can modify phone settings, such as installing/removing built-in apps, simulating tap events, transferring files, obtaining phone data, and so on.

To run ADB commands, usually you have to connect the phone to a computer. Now Termux provides an ADB package, and with the wireless ADB feature built into Android 11 and later, you can do the following:

  1. Let an Android phone ADB-debug itself without using a computer.

  2. Grant necessary system permissions to apps like Brevent, Ice Box, and Shizuku so they can function normally.

  3. When connected to the same Wi-Fi, phone A can send ADB commands to phone B and control the other phone.

  4. ADB with the Scrcpy app lets you control another phone, beating the hell out of any remote desktop.

Let’s look at the concrete steps.

1. Enable ADB wireless debugging
#

The location differs on every Android phone, so the following only covers the most common settings. ADB wireless debugging requires a Wi-Fi connection.

  1. Open the phone’s system settings, scroll to the bottom, and find “About phone”.

  2. Tap “Build number” 5 times to enable Developer options.

  3. Return to the system settings home page and search for “Developer options”

  4. In Developer options, check “ADB debugging” and “Wireless debugging”

  5. Always allow debugging on this Wi-Fi

  6. Tap into “Wireless debugging”, then press “Pair device with pairing code”

  7. Since the pairing-code dialog closes as soon as you leave it, you need to put the phone into “split screen”. Keep system settings on top and open the Termux app below, leaving the pairing-code dialog open.

2. Install the ADB package in Termux
#

Recommended reading first: How to Use Termux

  1. Open Termux and install the android-tools package
pkg install android-tools
  1. Confirm that the pairing-code dialog is still open, then enter the following command to start pairing and enter the six-digit Wi-Fi pairing code. Pairing only needs to be done once; this step is unnecessary afterward.
#        [IP address]      [port]
adb pair 192.168.1.101:41733
# Enter the pairing code
  1. Enter the following command to connect. Note that the port here is the port shown under “Device name”; it is different from the one used for Wi-Fi pairing just now, and it changes after every reboot.
adb connect 192.168.1.101:40505
  1. The system will show that wireless debugging is connected

  2. At this point you can exit split screen. Use the adb devices command to check whether the connection succeeded.

  3. Now you can run ADB commands.

References
#

Related


Thank you for reading. Public comments are not available on this website. I write to explore ideas honestly, not to chase social engagement or traffic. I would be glad to hear your thoughts after reading the article with care. If you found any errors, technical issues, or would like to share feedback, feel free to contact me via the email listed on the About page.