Search code examples
androiddebuggingadbwireless

Is there truly a way to send ADB commands without the usage of a cable to a non-rooted android device?


So, let's make this perfectly clear.

  • USB/Any other cable you can think of doesn't exist. I don't want to EVER use one. Not in the process of establishing an environment where USB cables don't need to be used afterwards, not EVER. Forget about cables, they don't exist.
  • My android device is a physical mobile phone, no emulators.
  • It's not rooted and I don't care about methods involving rooting. I don't want to root my phone.

Is there truly a way to establish the ADB and use it to send commands wirelessly on a non-rooted physical android device? My scenario is basically one PC Desktop computer and one Android device. Nothing else. I only need to establish ADB between the two under the mentioned conditions. If a method suiting my scenario and condition exists, what may it be?

There are countless of threads regarding this exact question, but many make the wrong answer and get good feedback, while others get moderated on and marked as duplicate of a thread that has absolutely nothing to do with the original question. A typical answer to this type of thread or a moderator's reference either contain the usage of a cable and/or rooting the device, while the question has made it perfectly clear not to use any of it.

It's misleading and annoying. I can't get a simple answer out of anywhere involving this question. It is confusing as it does not involve an answer that meets the original post's details, scenarios, etc.


Solution

  • Yes. You can connect your Android device over WiFi to your PC, no cable required:

    (These steps are taken directly from the Android Developer Docs here: https://developer.android.com/studio/command-line/adb)

    On Android 11+:

    1. On your workstation, update to the latest version of the SDK Platform-Tools.
    2. On the device, enable developer options.
    3. Enable the Wireless debugging option.
    4. On the dialog that asks Allow wireless debugging on this network?, click Allow.
    5. Select Pair device with pairing code. Take note of the pairing code, IP address, and port number displayed on the device.

    Wireless ADB pairing dialog

    1. On your workstation, open a terminal and navigate to android_sdk/platform-tools.
    2. Run adb pair ipaddr:port. Use the IP address and port number from step 5.
    3. When prompted, enter the pairing code that you received in step 5. A message indicates that your device has been successfully paired:
        none
        Enter pairing code: 482924
        Successfully paired to 192.168.1.130:37099 [guid=adb-235XY]
    
    1. (For Linux or Microsoft Windows only) Run adb connect ipaddr:port. Use the IP address and port under Wireless debugging:

    Wireless adb IP and port number