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

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


当前回答

虽然有这么多好的答案,这里是我对未来的我的两点意见:P和任何想要快速简单的人。

Mac:

首先使用USB连接设备,并确保调试工作正常。断开任何其他设备并退出模拟器。 打开终端,运行以下脚本 Adb tcpip 5555 Adb connect $(Adb shell ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d: -f2):5555 断开USB连接,设备应可进行WiFi调试

解释:

Adb tcpip 5555命令设备开始监听端口5555上的连接

Adb connect $(_ip_address_fetched_):5555表示连接到_ip_address_fetched_地址的5555端口

其中_ip_address_fetched_包含以下内容:

Adb shell ifconfig使用Adb shell获取Internet配置

Grep "inter "过滤任何以inter开头的行

排除本地主机。

此时,输出应该是这样的:

inet addr :###.###.#.# # #广播地址 :###.###.#.# # #面具:255.255.255.0

awk '{print $2}'获取组件数组的第二部分,用空格分隔(我使用zsh)。

到此为止的输出是

addr :###.###.#.###

Cut -d: -f2用分隔符分割字符串,然后取第二部分。它只会接收你的设备IP地址

其他回答

对于安卓11手机和安卓工作室大黄蜂版本,有新的更新。你只需要从安卓手机上扫描二维码就可以了 繁荣!它是相连的。

节省复制粘贴过程的时间。 有用的官方文件在这里

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

对于Ubuntu / Linux:

Make sure your device is working for debugging: http://developer.android.com/tools/help/adb.html#Enabling Go to your sdk folder and find the folder platform-tools Use ./adb devices to list the connected devices. Make sure it is only one device connected and no emulator running. Find your device IP address, you can find it in your device: http://developer.android.com/tools/help/adb.html#wireless, or got adb shell like this: ./adb shell then netcfg. You will see a list of IP addresses. Find wlan0, in my case 192.168.100.3/2. ./adb tcpip 5555 Finally enter ./adb connect <Your device IP Address>:5555 in your terminal. You can now deploy the application to your device over Wi-Fi.

使用ADB调试Android Wifi的步骤:

$> adb devices   // check all usb debuggable devices connected.

$> adb -d shell  // Access device shell.

shell> ifconfig  // Check and copy wifi ip-address eg:192.168.1.90

shell> exit      // Exit from android device shell.

$> adb tcpip 5000   // open TCP port 5000 (or any available)

$> adb connect 192.168.1.90:5000  // connect to device via wifi ip over specific TCP port.

$> adb devices   // you will get debuggabled android device over wifi.

必备:通过USB连接您的android设备到计算机 启用开发人员模式。同时将你的android设备和电脑连接起来 到同一个wifi路由器(或使用tethering)。

安装插件Android WiFi ADB

从Android Studio直接下载安装Android WiFi ADB:

文件>设置->插件->浏览存储库-> Android WiFi ADB ->安装->第一次连接线缆->单击“连接”->现在拆除线缆并开始进行调试/运行。

请参考以下资料: