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

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


当前回答

在Android 11的开发者选项中,有无线调试。确保你的笔记本电脑和手机在同一个网络下,然后执行下面的2个命令。注意,pair的端口与connect的端口不同,第一次只需要配对(以后只需要连接)。

Adb pair ipaddr:端口

adb pair 192.168.1.6:42049

// will output
Enter pairing code: 696686
Successfully paired to 192.168.1.6:42049 ...

Adb connect ipaddr:端口

adb connect 192.168.1.6:37203

// will output
connected to 192.168.1.6:37203

除了 如果你在“platform-tools”目录下,这些命令将只在android studio终端上工作。cd C:\Users\username\AppData\Local\Android\Sdk\平台工具>

其他回答

虽然有这么多好的答案,这里是我对未来的我的两点意见: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地址

我在这里找到了答案:

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

然后从头再来。

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

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

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

>##    open command prompt with Run as Administrtor ##

    adb connect ipdevice:5037