Search code examples
androidandroid-studioadbadbwireless

adb over Wi-Fi (Android 11+) on Windows: how to keep a fixed port or connect automatically?


The wireless adb connection works fine on my Android 11 phone + Windows workstation.

But it's not convenient, as every time the phone Wifi disconnects/reconnects, I have to:

  1. Turn on wireless debugging in Android settings.
  2. Take note of the port number XXXXX, which changes every time!
  3. Run adb connect 192.168.1.10:XXXXX on the computer.

Is there a way to skip step 2, by either:

  • making the port fixed?
  • making Windows automatically detect the phone on the new port? (documentation seems to imply that step 2 and 3 are not needed on MacOS, once the pairing is done, I wonder how this works)

Solution

  • The problem is now solved thanks to a recent update of Android Studio.

    All steps can now be automated:

    1. Turn on wireless debugging in Android settings. → this can be automated with a simple Tasker profile: when connected to your office wifi, set a custom setting to enable wireless debugging like so:

    tasker profile

    tasker task

    Or if you don't need full automation, you can probably add a quick switch for convenience. On a Pixel 3 it can be done in Settings > System > Developer options > Quick settings developer tiles > Wireless debugging

    1. Android Studio Bumblebee 2021.1.1 now automatically (after a few seconds) detects the device and connects to it! 🎉 No more copying of port numbers.