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

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


当前回答

我写了一个shell脚本,它可以让你通过Wi-Fi调试Android设备。

代码如下:

#!/usr/bin/env bash
#Notice: if unable to connect to [ip]:5555,
#try adb kill-server then try again.

adb shell ip route > addrs.txt
#Case 1:Nexus 7
#192.168.88.0/23 dev wlan0  proto kernel  scope link  src 192.168.89.48

#Case 2: Smartsian T1,Huawei C8813
#default via 192.168.88.1 dev eth0  metric 30
#8.8.8.8 via 192.168.88.1 dev eth0  metric 30
#114.114.114.114 via 192.168.88.1 dev eth0  metric 30
#192.168.88.0/23 dev eth0  proto kernel  scope link  src 192.168.89.152  metric 30
#192.168.88.1 dev eth0  scope link  metric 30

ip_addrs=$(awk {'if( NF >=9){print $9;}'} addrs.txt)

echo "the device ip address is $ip_addrs"

echo "connecting..."

rm addrs.txt

adb tcpip 5555

adb connect "$ip_addrs"

其他回答

通过USB连接设备并确保调试工作正常。如果您已经安装了adb并在environment varialbe中设置了它的路径,则执行这些步骤

打开CMD,输入以下命令 Adb tcpip 5555 使用adb shell IP route查找IP地址 adb connect DEVICE_IP_ADDRESS:5555 断开USB并进行无线调试。

最好的方法是使用ADBConnect (Eclipse插件)和ADB Wireless (Android设备应用程序)。

adb实用程序能够通过TCP/IP连接到设备。但是,adbd通常不会监听TCP连接。

如果您想让它运行,您需要一个工程设备(换句话说,您需要root)。然后按照这篇文章中的指导去做:

如何通过TCP连接到ADB的Android ?

由于这只适用于eng设备,所以它不受官方支持。使用风险自负,包括bug等。

从搜索和一些答案,我使用这个方法,它工作得很好 你必须知道tcpip并不总是5555,你必须按照这个找到它 首先需要下载平台工具

https://developer.android.com/studio/releases/platform-tools.html

解压平台-工具文件夹到C盘,在那里运行Powershell(右键单击>> Powershell >>打开这里)

#用usb线连接手机

PS C:\platform-tools> adb kill-server
PS C:\platform-tools> adb shell ip route > addrs.txt

#给出你的tcpip

* daemon not running; starting now at tcp:5037 
* daemon started successfully
PS C:\platform-tools> adb tcpip 5037
restarting in TCP mode port: 5037

#断开电话 #adb connect <phone_ip>:5037

PS C:\platform-tools> adb connect 192.168.43.1:5037
connected to 192.168.43.1:5037

现在你可以看到你的手机在安卓工作室

我为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进行部署/调试。