增加Android11及以上版本 无需root的无线连接方式 (#80)

* Add connect to a device over Wi-Fi (Android 11+)

新增 无线连接(Android11 及以上)

* Update README.md

* Update README.en.md

* Update README.md

修改[无线连接(Android11 及以上)]的说明文本为官网页面上源文本

* Update README.en.md

修改英语文档中错误的编号
master
Tang 4 years ago committed by GitHub
parent ad30a199b9
commit 4e236d4b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      README.en.md
  2. 45
      README.md

@ -22,6 +22,7 @@ Other languages: [:cn: Chinese](./README.md)
* [Device connection management](#device-connection-management) * [Device connection management](#device-connection-management)
* [Inquiries connected device / simulator](#inquiries-connected-device--simulator) * [Inquiries connected device / simulator](#inquiries-connected-device--simulator)
* [USB connection](#usb-connection) * [USB connection](#usb-connection)
* [Wireless connection (Android11+)](#wireless-connection-Android11)
* [Wireless connection (need to use the USB cable)](#wireless-connection-need-to-use-the-usb-cable) * [Wireless connection (need to use the USB cable)](#wireless-connection-need-to-use-the-usb-cable)
* [Wireless connection (without using the USB cable)](#wireless-connection-without-using-the-usb-cable) * [Wireless connection (without using the USB cable)](#wireless-connection-without-using-the-usb-cable)
* [Application Management](#application-management) * [Application Management](#application-management)
@ -298,6 +299,38 @@ Developer Options 2. Android devices and USB debugging mode is on.
Description Connection successful. Description Connection successful.
### Wireless connection (Android11+)
[Doc in Android developers](https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+)
Android 11 and higher support deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without physically connecting your device via USB. This eliminates the need to deal with common USB connection issues, such as driver installation.
To use wireless debugging, you need to pair your device to your workstation using a pairing code. Your workstation and device must be connected to the same wireless network. To connect to your device, follow these steps:
1. Update to the latest version of the [SDK Platform-Tools](https://developer.android.com/studio/releases/platform-tools).
2. Connect Android device to run adb computer connected to the same local area network, such as connected to the same WiFi.
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.
6. On your workstation, open a terminal and navigate to `android_sdk/platform-tools`.
7. Run `adb pair ipaddr:port`. Use the IP address and port number from step 5.
8. When prompted, enter the pairing code that you received in step 5. A message indicates that your device has been successfully paired.
```sh
none
Enter pairing code: xxxxxx
Successfully paired to ...
```
9. (For Linux or Microsoft Windows only) Run `adb connect ipaddr:port`. Use the IP address and port under **Wireless debugging**.
### Wireless connection (need to use the USB cable) ### Wireless connection (need to use the USB cable)
In addition to the USB connection to the computer to use adb, can also be a wireless connection - although the connection process is also step using USB needs, but after a successful connection to your device can get rid of the limit of the USB cable within a certain range it ! In addition to the USB connection to the computer to use adb, can also be a wireless connection - although the connection process is also step using USB needs, but after a successful connection to your device can get rid of the limit of the USB cable within a certain range it !

@ -26,6 +26,7 @@ Other languages: [:gb: English](./README.en.md)
* [设备连接管理](#设备连接管理) * [设备连接管理](#设备连接管理)
* [查询已连接设备/模拟器](#查询已连接设备模拟器) * [查询已连接设备/模拟器](#查询已连接设备模拟器)
* [USB 连接](#usb-连接) * [USB 连接](#usb-连接)
* [无线连接(Android11 及以上)](#无线连接Android11-及以上)
* [无线连接(需要借助 USB 线)](#无线连接需要借助-usb-线) * [无线连接(需要借助 USB 线)](#无线连接需要借助-usb-线)
* [无线连接(无需借助 USB 线)](#无线连接无需借助-usb-线) * [无线连接(无需借助 USB 线)](#无线连接无需借助-usb-线)
* [应用管理](#应用管理) * [应用管理](#应用管理)
@ -312,6 +313,50 @@ emulator-5554 device
说明连接成功。 说明连接成功。
### 无线连接(Android11 及以上)
Android 11 及更高版本支持使用 Android 调试桥 (adb) 从工作站以无线方式部署和调试应用。例如,您可以将可调试应用部署到多台远程设备,而无需通过 USB 实际连接设备。这样就可以避免常见的 USB 连接问题,例如驱动程序安装方面的问题。
[官方文档](https://developer.android.com/studio/command-line/adb?hl=zh_cn#connect-to-a-device-over-wi-fi-android-11+)
操作步骤:
1. 更新到最新版本的 [SDK 平台工具](https://developer.android.com/studio/releases/platform-tools?hl=zh_cn)(至少30.0.0)。
2. 将 Android 设备与要运行 adb 的电脑连接到同一个局域网,比如连到同一个 WiFi。
3. 在开发者选项中启用**无线调试**。
4. 在询问要允许在此网络上进行无线调试吗?的对话框中,点击允许。
5. 选择使用配对码配对设备,使用弹窗中的 IP 地址和端口号。
```sh
adb pair ipaddr:port
```
6. 提示`Enter pairing code: `时输入弹窗中的配对码,成功后会显示`Successfully paired to ...`。
7. 使用无线调试下的 **IP 地址和端口**
```sh
adb connect ipaddr:port
```
8. 确认连接状态。
```sh
adb devices
```
如果能看到
```sh
ipaddr:port device
```
说明连接成功。
### 无线连接(需要借助 USB 线) ### 无线连接(需要借助 USB 线)
除了可以通过 USB 连接设备与电脑来使用 adb,也可以通过无线连接——虽然连接过程中也有需要使用 USB 的步骤,但是连接成功之后你的设备就可以在一定范围内摆脱 USB 连接线的限制啦! 除了可以通过 USB 连接设备与电脑来使用 adb,也可以通过无线连接——虽然连接过程中也有需要使用 USB 的步骤,但是连接成功之后你的设备就可以在一定范围内摆脱 USB 连接线的限制啦!

Loading…
Cancel
Save