我认为有一种方法可以通过Wi-Fi测试开发中的应用程序。这可能吗?
我希望能够解开我的手机,无线开发。
我认为有一种方法可以通过Wi-Fi测试开发中的应用程序。这可能吗?
我希望能够解开我的手机,无线开发。
当前回答
我在这里找到了答案:
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
然后从头再来。
其他回答
我为Windows写了一个简单的脚本:
步骤1。用以下命令创建一个批处理文件,调用wifi_dedug.bat文件并复制以下内容:
adb tcpip 5555
pause
adb shell "ip addr show wlan0 | grep 'inet ' | cut -d' ' -f6|cut -d/ -f1" > tmpFile
pause
set /p ip= < tmpFile
@echo %ip%
del tmpFile
@echo %ip%
adb connect %ip%
pause
步骤2。将您的设备连接到pc。
步骤3。启动批处理文件(按要求输入键)
步骤4。断开设备连接,通过wifi进行部署/调试。
如果你使用Android 11多次点击构建版本激活开发人员选项,然后进入设置>高级>开发人员选项。滚动到调试并打开“无线调试”复选框。点击“无线调试”打开调试菜单。选择“配对设备与配对码”,您将看到与配对码配对的地址。在你的桌面终端上写这个命令来与你的Android设备配对。
adb pair 192.168.XXX.XXX:XXXX <--------- the address showing on screen under paring code
使用配对代码进行连接。 但是等等,我们还没有连接到adb。 在您成功配对您的设备一次之后。您可以在打开无线调试选项的任何时候连接adb。从现在开始,在每次使用adb之前连接它,您不再需要配对地址,而是使用当您进入无线调试菜单时显示的给定地址。
adb connect 192.168.XXX.XXX:XXXX <--- this address shows inside wireless debug menu
通过USB连接设备并确保调试工作正常。如果您已经安装了adb并在environment varialbe中设置了它的路径,则执行这些步骤
打开CMD,输入以下命令 Adb tcpip 5555 使用adb shell IP route查找IP地址 adb connect DEVICE_IP_ADDRESS:5555 断开USB并进行无线调试。
我使用adb shell ip -f inet addr show wlan0来查找adb tcpip 5555之后的设备ip。
新版本已弃用adb netcfg。因此,当接口名称为wlan0(默认接口名称)时,这是查找设备ip的正确方法。
adb实用程序能够通过TCP/IP连接到设备。但是,adbd通常不会监听TCP连接。
如果您想让它运行,您需要一个工程设备(换句话说,您需要root)。然后按照这篇文章中的指导去做:
如何通过TCP连接到ADB的Android ?
由于这只适用于eng设备,所以它不受官方支持。使用风险自负,包括bug等。