如何使用 adb over WiFi 在 Android Studio 中进行调试

问题描述:

我可以使用 adb connect 连接到我的手机,我也可以使用 adb shell.

I'm able to connect to my phone using adb connect, and I can adb shell also.

但是当我转到运行->设备选择器时,那里没有设备.

But when I go to Run->Device Chooser, there are no devices there.

我应该怎么做才能连接我的(已连接的)adb Android Studio?

What should I do to connect my (connected) adb Android Studio?

当我通过 USB 插入时,它会显示在列表中

When I plug it in through USB, it shows up on the list

你可以在/platform-tools/中找到adb工具

You can find the adb tool in /platform-tools/

cd Library/Android/sdk/platform-tools/

您可以使用以下方法检查您的设备:

You can check your devices using:

./adb devices

我的结果:

List of devices attached
XXXXXXXXX   device

设置 TCP 端口:

./adb shell setprop service.adb.tcp.port 4444

./adb tcpip 4444

结果信息:

restarting in TCP mode port: 4444

要初始化 wifi 连接,您必须检查您的设备 IP 并执行:

To init a wifi connection you have to check your device IP and execute:

./adb connect 192.168.0.155:4444

祝你好运!