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

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


当前回答

当你按照上面的答案https://stackoverflow.com/a/10236938/6117565,你可能会得到错误“没有路由到主机”。

要解决这个问题,在上述回答的第5步之前,首先启动模拟器,然后尝试连接设备。不知道发生了什么,但这个把戏奏效了。

其他回答

在游戏商店下载应用程序Wifi ADB。非常容易使用,工作就像一个魅力!:)

有办法查看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命令。

如果您是windows用户,并且您的android sdk位于C:\Users\%username%\AppData\Local\ android \ sdk,那么您可以遵循此方法。如果你的andoid sdk不在那里,将该路径替换为下面的代码。

@echo off
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" disconnect
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" shell ip route > %temp%\addrs12321.txt
For /F "UseBackQ Delims==" %%A In ("%temp%\addrs12321.txt") Do Set "lastline=%%A"
FOR %%C IN (%lastline%) DO SET last=%%C
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" tcpip 5555
"C:\Users\%username%\AppData\Local\Android\Sdk\platform-tools\adb.exe" connect %last%:5555 > %temp%\adbresult.txt
set /p result=<%temp%\adbresult.txt
del /f %temp%\addrs12321.txt
echo MSGBOX "%result%" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q
del %temp%\adbresult.txt /f /q

步骤1。

打开usb调试, 把你的手机连接到windows电脑上 在android菜单的usb选项菜单中选择文件传输(如果找到)

步骤2。

复制以上代码 保存为扩展名,如。bat,如filename.bat 双击您保存的文件。完成

请注意,您可以通过在设备运行该文件来随时连接 打开usb调试与PC连接。

我在这里找到了答案:

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

然后从头再来。

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