我认为有一种方法可以通过Wi-Fi测试开发中的应用程序。这可能吗?
我希望能够解开我的手机,无线开发。
我认为有一种方法可以通过Wi-Fi测试开发中的应用程序。这可能吗?
我希望能够解开我的手机,无线开发。
当前回答
我在这里找到了答案:
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
然后从头再来。
其他回答
虽然有这么多好的答案,这里是我对未来的我的两点意见: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地址
在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\平台工具>
确保你的电脑和安卓系统连接在同一个wifi上。 从你的手机启动adb服务器… 从playstore下载任何无线adb应用程序…这是我正在用的 无线ADB -空中调试 在您的计算机上启动CMD并运行: 代码(csharp): Adb连接192.168.1.100:5555 请确保将192.168.1.100替换为实际分配给设备的IP地址。
检查是否通过以下方式连接: 代码(csharp): 亚洲开发银行设备 4. 启动统一或重新启动,如果它已经运行并点击播放。
tadaa...........:eek:
>## open command prompt with Run as Administrtor ##
adb connect ipdevice:5037
Windows:
步骤1。使用下面的命令创建一个批处理文件,并将该文件称为w.bat。
步骤2。将下面的内容复制到w.b bat中,并保存在Windows系统%path%中的任意文件夹中
echo ***Get phone in Wi-Fi mode***
echo ***Get phone in Wi-Fi mode***
adb devices
echo ***Remove cable from the phone now***
adb tcpip 9000
adb connect 192.168.1.1:9000
adb connect 192.168.1.2:9000
adb connect 192.168.1.3:9000
adb connect 192.168.1.4:9000
adb connect 192.168.1.5:9000
adb connect 192.168.1.6:9000
<--到这里-->
步骤3。用数据线连接你的手机和电脑
步骤4。确保手机处于Wi-Fi模式
第5步。当批处理文件要求您移除电缆时
步骤6。在Windows提示符上输入w.bat (start -> run -> Type CMD,按Enter)(黑屏是Windows DOS提示符),如果你在其中一个路径文件夹中复制了它,那么你可以从任何地方运行,否则从你创建这个文件的文件夹运行。
批处理文件的输出如下所示:
C:\Windows\System32>w
C:\Windows\System32>echo ***Get phone in Wi-Fi mode***
***Get phone in Wi-Fi mode***
C:\Windows\System32>echo ***Get phone in Wi-Fi mode***
***Get phone in Wi-Fi mode***
C:\Windows\System32>adb devices
List of devices attached
d4e9f06 device
C:\Windows\System32>echo ***Remove cable from the Phone now***
***Remove cable from the Phone now***
C:\Windows\System32>adb tcpip 9000
restarting in TCP mode port: 9000
C:\Windows\System32>adb connect 192.168.1.1:9000
unable to connect to 192.168.1.1:9000:9000
C:\Windows\System32>adb connect 192.168.1.2:9000
connected to 192.168.1.2:9000
C:\Windows\System32>adb connect 192.168.1.3:9000
unable to connect to 192.168.1.3:9000:9000
C:\Windows\System32>adb connect 192.168.1.4:9000
unable to connect to 192.168.1.4:9000:9000
C:\Windows\System32>adb connect 192.168.1.5:9000
unable to connect to 192.168.1.5:9000:9000
C:\Windows\System32>adb connect 192.168.1.6:9000
unable to connect to 192.168.1.6:9000:9000
注1:在输出中找到这个,(忽略所有->unable to connect<- errors)
connected to xxx.xxx.x.x:9000
如果你在结果中看到这个,只需从PC上移除电缆,进入Eclipse并运行在设备上安装应用程序;应该是这样。
注意2:断开或切换无线模式关闭:键入下面的命令。它应该说在USB模式下重新启动-在这个阶段PC和计算机不应该用电缆连接:
C:\Users\dell>adb usb
restarting in USB mode
注3:查找话机IP地址的步骤(取自Stack Overflow)
查找MY PHONE的IP地址:
a. Dial *#*#4636#*#* to open the Testing menu.
b. In the Wi-Fi information menu: click Wi-Fi Status
c. Wi-Fi status can be blank for the first time
d. Click Refresh Status
e. In the IPaddr: <<IP ADDRESS OF THE PHONE IS LISTED>>
注4:我的手机Wi-Fi连接IP地址范围一般为下面提到的IP地址,
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.6
注意5:如果你得到的IP地址序列不断被重新分配给你的手机,你可以在w.b bat文件中修改IP地址。
注意6:这是一种强制方法,它消除了寻找IP地址和连接到Eclipse / Wi-Fi的所有手工劳动。
所以简而言之,常规的活动应该是这样的:
Step 1. Connect PC and Wi-Fi via a cable
Step 2. Start CMD - to go to Windows DOS prompt
Step 3. Type "w"
Step 4. Find connected command in the output
Step 5. Success, remove cable and start using Eclipse