我想将adb连接到实时的Android设备,而不是模拟器,但是出现错误:“无法连接到192.168.10.4:5555:因为目标计算机积极拒绝了连接(10061)。” 我尝试了这个命令:adb connect
cd myandroidsdk/platform-tools
adb pair ipaddr:port
ipaddr
和port
。终端将提示您输入配对码。
https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+
设备管理器 > 物理设备 > 使用Wi-Fi进行配对
然后前往你手机的设置页面 开发者选项 > 无线调试 > 使用QR码进行配对
扫描QR码后你的手机将会连接到Android Studio。Note: this feature works on Android 11+ devices
旧设备
确保您的手机和笔记本电脑连接到同一个路由器
使用USB线将手机连接到笔记本电脑
打开终端窗口
adb devices
命令行响应应该类似于:
List of devices attached E1MGAP2810904770 device
adb tcpip 5556
adb connect 192.168.1.47:5556
命令行响应应该类似于:
connected to 192.168.1.47:5556
用本地 IP 地址替换192.168.1.47。
您可以在“设置” ->“状态”中找到您手机的IP地址...
1. Open terminal in the directory of adb. So for windows Open cmd in ...\AppData\Local\Android\sdk\platform-tools
2. Run `adb devices` to confirm that no device is connected
3. run `adb connect <IP address of your device>:5555`
4. Run `adb devices` again, it should show your physical device.
也许您需要通过连接 USB 首先启用 USB 调试来安装任何应用程序。然后,上述方法适用于该手机(我的 Android Studio 版本为 Flamingo 2022.2.1)。
在 Linux 中,请使用 ./adb
替代 adb
。转到“设置” -> “关于手机” -> “所有规格” -> “状态”以查看您手机的 IP 地址。
连接到 DNS 服务器 IPv4 地址而不仅仅是 IPv4 地址。在您的无线属性中进行检查。
adb -s <device id> tcpip 5555
这个命令? - Rajen Raiyarela