简体   繁体   English

如何在没有 usb 电缆的情况下通过 wifi 网络连接 ADB?

[英]How to connect ADB over wifi network without usb cable?

I want to connect my adb to real-time android, not to emulator but it gives an error: "cannot connect to 192.168.10.4:5555: No connection could be made because the target machine actively refused it. (10061)" I tried this command: adb connect我想将我的 adb 连接到实时 android,而不是模拟器,但它给出了错误:“无法连接到 192.168.10.4:5555:无法连接,因为目标机器主动拒绝它。(10061)”我试过了这个命令: adb connect

It is possible starting with Android 11. On the phone click Pair device with pairing code , then on the dev machine do the following:可以从 Android 11 开始。在手机上单击Pair device with pairing code ,然后在开发机器上执行以下操作:

cd myandroidsdk/platform-tools
adb pair ipaddr:port

Take ipaddr and port from your phone.从手机中获取ipaddrport The terminal will then prompt you to put in the pairing code.然后终端将提示您输入配对代码。

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

Make sure your phone and laptop are connected to the same router确保您的手机和笔记本电脑连接到同一个路由器

  • connect your phone to your laptop with usb cable使用 usb 电缆将手机连接到笔记本电脑
  • open a terminal window打开一个终端 window
  • adb devices

    shell response should be something like this: shell 响应应该是这样的:

    List of devices attached E1MGAP2810904770 device

  • adb tcpip 5556

  • adb connect 192.168.1.47:5556

    shell response should be something like this: shell 响应应该是这样的:

    connected to 192.168.1.47:5556

change the 192.168.1.47 with your local IP address.用您当地的 IP 地址更改 192.168.1.47。

you can find your phone's IP Address in Settings -> Status...您可以在设置 -> 状态...中找到您手机的 IP 地址...

Please follow the below link to get the detailed answer:请点击以下链接获取详细答案:

https://developer.android.com/studio/run/device https://developer.android.com/studio/run/device

And one more think, don't connect your mobile with charger while connecting the android studio to mobile without usb cable.还有一个想法是,在将 android 工作室连接到没有 usb 电缆的手机时,不要将手机连接到充电器。

Connect to DNS Server IPv4 address instead of just IPv4 address.连接到 DNS 服务器 IPv4 地址,而不仅仅是 IPv4 地址。 Check in your wireless properties.检查您的无线属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM