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

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


当前回答

如果你使用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

其他回答

有办法查看Android屏幕远程没有根?- 9号帖子。

通过USB连接设备,并确保调试工作正常; Adb tcpip 5555。这使得设备开始监听端口5555上的连接; 使用adb shell netcfg或adb shell ifconfig(6.0及以上版本)查找设备IP地址; 您现在可以断开USB; adb connect <DEVICE_IP_ADDRESS>:5555。这将连接到我们在步骤2中在设备上设置的服务器; 现在您在网络上有了一个设备,可以像往常一样使用它进行调试。

要将服务器切换回USB模式,请运行adb USB,这将使您手机上的服务器恢复到USB模式。如果您有多个设备,您可以使用-s选项指定设备:adb -s <DEVICE_IP_ADDRESS>:5555 usb。

不需要根!

如果需要查询设备的IP地址,请先执行adb shell命令,再执行netcfg命令。你会在那里看到。 当使用OSX时,可以使用adb shell IP route命令查询IP地址。


警告:启用该选项是危险的,网络中的任何人都可以在调试中连接到您的设备,即使您是在数据网络中。只有连接到可信任的Wi-Fi时才可以这样做,完成后记得断开连接!


@Sergei建议修改第2行,评论道:“当另一个连接持续时(例如,模拟器连接或其他Wi-Fi设备),-d选项需要连接到USB设备”。

这些信息可能对未来的读者很有价值,但我还是回到了得到178个赞的原始版本。


在一些设备上,即使你没有USB线,你也可以做同样的事情:

在开发人员设置中启用网络ADB 它应该显示IP地址 adb connect <DEVICE_IP_ADDRESS>:5555 完成后禁用该设置


使用Android Studio有一个插件,允许您连接USB调试,而不需要从终端使用任何ADB命令。

1-为此,我认为你已经安装了最新版本的Android studio。如果没有,你可以从这里下载。

2 -可以在“环境变量”中设置平台工具路径(可选)。

3 -确保你的设备和电脑连接到同一个网络。

plug in the data cable from pc to device. Now, type adb tcpip 5555 remove data cable. Then type adb connect 192.168.43.95 here 5555 is the port number and 192.168.43.95 is the ip address of the mobile device you can get id address from the mobile settings . Then go to About device and go to status you can see the ip address of the device. You can connect multiple device from different ports which can give ease in development. Or you can go to this link for brief description with screenshots. http://blogssolutions.co.in/connect-your-android-phone-wirelessly-by-adb

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

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

使用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)。

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

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