我认为有一种方法可以通过Wi-Fi测试开发中的应用程序。这可能吗?

我希望能够解开我的手机,无线开发。


当前回答

我使用adb shell ip -f inet addr show wlan0来查找adb tcpip 5555之后的设备ip。

新版本已弃用adb netcfg。因此,当接口名称为wlan0(默认接口名称)时,这是查找设备ip的正确方法。

其他回答

在Android 11的开发者选项中,有无线调试。确保你的笔记本电脑和手机在同一个网络下,然后执行下面的2个命令。注意,pair的端口与connect的端口不同,第一次只需要配对(以后只需要连接)。

Adb pair ipaddr:端口

adb pair 192.168.1.6:42049

// will output
Enter pairing code: 696686
Successfully paired to 192.168.1.6:42049 ...

Adb connect ipaddr:端口

adb connect 192.168.1.6:37203

// will output
connected to 192.168.1.6:37203

除了 如果你在“platform-tools”目录下,这些命令将只在android studio终端上工作。cd C:\Users\username\AppData\Local\Android\Sdk\平台工具>

如果你想在设备上启用无线adb,而不需要连接USB线(root要求):

在设备上安装终端应用程序(如Android终端模拟器) 输入以下内容 苏 Setprop service.adb.tcp.port 5555 停止adbd 开始adbd

因为你已经打开了终端,你可以找到设备的IP地址:

ip addr show

然后在调试环境中运行命令:

adb connect ip.of.the.device

这将使该设备被列为您可能拥有的任何其他模拟器。请注意,在重置设备之前,TCP将保持打开状态。 如果你经常断网,你可能还想安装一个Wi-Fi Keep Alive应用程序。

如果你想要安全,记得在连接到公共网络时关闭TCP。您可以执行以下操作或简单地重新启动设备:

苏 Setprop service.adb.tcp.port -1 停止adbd 开始adbd

(不需要根)有一个最好的,简单的和Android Studio的UI方法

IntelliJ和Android Studio插件创建快速连接您的Android设备通过WiFi安装,运行和调试您的应用程序没有USB连接。按下一个按钮,就不用管USB线了。

只需安装插件Android WiFi ADB

直接下载安装Android WiFi ADB

Intellij / Android Studio:首选项/设置->插件->浏览库

.

记住!第一次初始化设备,您必须使用usb连接

或者,您也可以从JetBrains插件站点下载插件并手动安装:Preferences/Settings->Plugins->从磁盘安装插件。

您可以轻松连接和管理您的设备.......更多信息请阅读这里https://github.com/pedrovgs/AndroidWiFiADB

我在这里找到了答案:

Connect Android device and adb host computer to a common Wi-Fi network accessible to both. We have found that not all access points are suitable; you may need to use an access point whose firewall is configured properly to support adb. Connect the device with USB cable to host. Make sure adb is running in USB mode on host. $ adb usb restarting in USB mode Connect to the device over USB. $ adb devices List of devices attached ######## device Restart host adb in tcpip mode. $ adb tcpip 5555 restarting in TCP mode port: 5555 Find out the IP address of the Android device: Settings -> About tablet -> Status -> IP address. Remember the IP address, of the form #.#.#.#. sometimes its not possible to find the IP-address of the android device, as in my case. so u can get it using adb as the following: $ adb shell netcfg and the should be in the last line of the result. Connect adb host to device: $ adb connect #.#.#.# connected to #.#.#.#:5555 Remove USB cable from device, and confirm you can still access device: $ adb devices List of devices attached #.#.#.#:5555 device

现在可以开始了!

如果adb连接丢失:

确保你的主机仍然连接到你的Android设备所在的Wi-Fi网络。 再次执行“adb connect”步骤重新连接。 或者如果这不起作用,重置你的adb主机: 亚行kill-server

然后从头再来。

要完成@usethe4ce的回答,如果您有多个设备或模拟器,adb tcpip 5555将给出错误:多个设备/模拟器。

在这种情况下,您需要给出所需设备的序列号:

亚洲开发银行设备 所附设备清单 33001229的设备 模拟器- 5554设备 Adb -s 33001229 tcpip 5555 在我的情况下,我可以从设备的wifi连接设置中找到它。 Adb connect xxx.xxx.xxx.xxx:5555