This article is simultaneously published on my wechat official account. You can follow it by scanning the QR code at the bottom of the article or searching Fireantzhang on wechat.

preface

As you should know, I wrote an old post: Do you know the ADB wireless development model? , but today I want to introduce you to Android 11 wireless debugging has a new change.

In the wireless debugging mode introduced in the previous article, you need to connect a USB cable to complete the wireless debugging of your phone and computer for the first time, and you have to repeat the operation every time (imagine having to connect a USB cable to go to work every morning).

Google engineers noticed the downside of this wireless debugging mode, so Android 11, which has been updated for a while, has a new pairing method that doesn’t require a USB cable to enable wireless pairing between An Android device and a computer from the start. (As convenient as Bluetooth pairing)

A prerequisite for

Let’s take a look at the prerequisites for using such a cool debugging approach:

  • Android phones need to run Android 11 or higher;
  • The Android SDK tool version on the PC must be ≥ 30.0.0. The verification method is as follows:adb --version
~ » adb --version
Android Debug Bridge version 1.0.41
Version 30.0.5-6877874
Copy the code
  • Android phones and PCS need to be connected to the same WiFi network;

Pairing steps

Once you’ve confirmed that these conditions are in place, it’s time to start wireless debugging for Android 11:

  1. Enable Developer mode on mobile & USB debug (usually for mobile –> continuously tap the version number until it prompts you to enter Developer mode);
  2. Enable wireless debugging options;
  3. Do you want to allow wireless debugging on this network? Dialog box, click Allow.
  4. After the third step, the wireless debugging service has been successfully enabled on the mobile phone.Go to Wireless Debug --> Use match code to pair the deviceYou can see the pairing code, IP and port number (see picture for details, each click will generate a new one)

5. Run it on the terminal on the computeradb pair ipaddr:portThat is as follows:

Adb pair 192.168.3.161:37933 // Adb pair 192.168.3.161:37933 // Enter the pairing code obtained in 4. Enter pairing code: 662287 Successfully paired to 192.168.3.161:37933 [GUid = ADB-05kay1xpbC-hyxnzi]Copy the code
  1. The inputadb devices -lYou can see the device successfully connected through wireless connection as follows:
~ » ADB devices -l List of devices attached ADB-05kay1xpbC-hyxnzi. _adb-TLS-connect._tcp. Device product:sargo model:Pixel_3a device:sargo transport_id:2Copy the code

After completing these steps, we can have fun writing bugs. Even better, these actions are memorized, which means that two devices (phone and computer) that have been successfully paired will automatically match each time they connect to the same WiFi without human intervention.

Feel the use of it, directly release your computer’s scarce USB port, what lack of Android 11? That’s a lot of reasons to ask the bosses for an Android 11 test machine. I’m sure you can do it

Ps: There is only one defect found so far, that is, if the phone is disconnected from WiFi and connected again, the wireless debugging option needs to be manually opened again (other steps are not required); However, this disadvantage is acceptable, after all, less likely to disconnect and reconnect your phone’s WiFi.