Android 11’s Wireless debugging

Urvesh Tanna
4 min readJul 4, 2020

--

Image Source: 9to5google.com

Android 11 developer preview has lots of new features to look but one of the coolest is Wireless debugging. It is a new method for developers to pair their Android devices with a computer wirelessly. Before we dive more into this new method let’s check the methods available before this.

Past:

Before Android 11 connecting your android device with a computer was possible by the following 2 methods:

  1. Using a USB cable: This is the easiest method and just needs you to plug in your device via USB. The cons here are you always need to have a USB cable, it could limit the number of devices you can plug-in depending on available ports or could also affect your device’s battery over time as it is always charging when plugged in.
  2. ADB Over Wireless: This method is possible using ADB’s tcpip and connect commands which help you use your devices wirelessly. But to execute both of the commands your device needs to be plugged in via USB. Also later when you want to reconnect your device again you need to go through the same process.

The New Solution:

Wireless debugging in Android 11 is a new method to pair your android device with your computer wirelessly. This is possible because of the new ADB command called pair which works similar to pairing a Bluetooth device. Wireless debugging solves most of the cons of past methods:

  • No USB cable required or any additional USB drivers to install
  • You can debug on multiple devices at the same time
  • Reconnecting with a paired device is just one tap

Let’s see how to pair your device using the Wireless debugging method

Prerequisite:

  1. You need to have a physical device running on Android 11 with developer options enabled.
  2. You need to have SDK platform-tools with version ≥ 30.0.0. If you don’t have it then you can download the latest version from here or just update it using SDK manager in Android Studios.
  3. Your physical device and computer should be on the same WiFi network

Steps to Pair (Updated):

Option A: Using android Studios Bumblebee (2021.1.1) and new

  1. Open Android studios & the project you want to run
  2. Under Device Selection Dropdown > Pair new devices over WiFi. Follow the instruction on the dialog
Source: https://android-developers.googleblog.com/

Option B: Manually connecting

  1. Go to the device Settings > Developer Options > Enable Wireless debugging
  2. Select Pair device with pairing code. (Currently, there are two options to pair it with your computer. Using a QR code or pairing a device using a six-digit code.)
After tapping Pair device with pairing code you will see a popup as shown in the above image with your device-specific pairing code, IP address & port.

3. On your computer navigate to android_sdk/platform-tools directory. Skip this step if you have set ADB path in environment variables.

4. Now open the terminal and run adb pair ipaddr:port. Where ipaddr is the IP address and port is the port number from Step 2. (After running the command if your terminal says adb: unknown command pair then you need to update your SDK platform-tools)

$ adb pair 192.168.0.101:42607

5. The above ADB command will now prompt you to enter the pairing code. (This pairing code can be seen on Step 2).

$ adb pair 192.168.0.101:42607
Enter pairing code: 197872

6. Once successfully paired you will see a message on the terminal and also an ongoing notification on your device.

$ adb pair 192.168.0.101:42607
Enter pairing code: 197872
Successfully paired to 192.168.0.101:42607

7. Once your device is successfully paired, you need to connect with your device using the following command:

$ adb connect ipaddr:port
Ongoing notification on your android device.

8. To reconnect with your paired device Enable Wireless debugging from your android device Settings and then you should see the same ongoing notification on your device.

You can also manage all the paired devices under the Wireless debugging option.

That’s it, World!

Hope the article was interesting. If you have any queries or comments feel free to write below.

Source: https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+

--

--