android 无线调试_Android 11的无线调试

android 无线调试

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.

Android 11开发人员预览版具有许多新功能,但最酷的功能之一是无线调试 。 这是开发人员将其Android设备与计算机无线配对的一种新方法。 在我们进一步研究这种新方法之前,让我们先检查一下可用的方法。

过去: (Past:)

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

在Android 11之前,可以通过以下2种方法将android设备与计算机连接:

  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.

    使用USB电缆:这是最简单的方法,只需要您通过USB插入设备即可。 缺点是您始终需要USB电缆,这可能会限制您可以插入的设备数量(取决于可用端口),或者随着时间的流逝也会影响设备的电池电量,因为插入时总是在充电。

  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.

    无线ADB:使用ADB的tcpipconnect命令可以使用此方法,这些命令可帮助您无线使用设备。 但是要执行这两个命令,您的设备需要通过USB插入。 同样,稍后要重新连接设备时,也需要执行相同的过程。

新解决方案: (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:

Android 11中的无线调试是一种将Android设备与计算机无线配对的新方法。 由于新的称为pair ADB命令与配对蓝牙设备类似,因此可以实现这一点。 无线调试解决了过去方法的大多数缺点:

  • No USB cable required or any additional USB drivers to install

    无需USB电缆或要安装的任何其他USB驱动程序
  • 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.

    您需要在启用了开发人员选项的Android 11上运行物理设备。
  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.

    您需要拥有版本≥30.0.0的SDK平台工具。 如果您没有此文件,则可以从此处下载最新版本,或者仅使用Android Studios中的SDK管理器进行更新。

  3. Your physical device and computer should be on the same WiFi network

    您的物理设备和计算机应位于同一WiFi网络上

配对步骤: (Steps to Pair:)

  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.)

    选择将设备与配对代码配对。 (当前,有两个选项可将其与计算机配对。使用QR码或使用六位数代码配对设备。)

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. 设备与配对代码配对后,您将看到如上图所示的弹出窗口,其中包含设备特定的配对代码,IP地址和端口。

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

3.在您的计算机上,导航到android_sdk / platform-tools目录 如果您在环境变量中设置了ADB路径,请跳过此步骤。

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)

4.现在打开终端并运行adb pair ipaddr:port 。 其中ipaddr是IP地址,而port是步骤2中的端口号。(运行命令后,如果终端显示adb: unknown command pair则需要更新SDK平台工具 )

$ 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).

5.上面的ADB命令现在将提示您输入配对代码。 (此配对代码可以在步骤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.

6.成功配对后,您将在终端上看到一条消息,并在设备上看到一条持续的通知。

$ adb pair 192.168.0.101:42607
Enter pairing code: 197872Successfully paired to 192.168.0.101:42607
Ongoing notification on your android device. 您的android设备上的持续通知。

6. 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.

6.要重新连接已配对的设备,请从android设备的“设置”中启用“无线调试 ”,然后您应该在设备上看到相同的正在进行的通知。

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/preview/features#wireless-adb

来源: https : //developer.android.com/preview/features#wireless-adb

翻译自: https://medium.com/@urvesh/android-11s-wireless-debugging-5d0f6448ee3

android 无线调试

你可能感兴趣的:(android,debug,python,安卓)