对于 Windows:
步骤 1. 使用以下命令创建一个批处理文件并调用文件w.bat。
步骤2.复制w.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(开始 -> 运行 -> 键入 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:在输出中找到这个,(忽略所有->无法连接
connected to xxx.xxx.x.x:9000
如果您在结果中看到这一点,只需从 PC 上拔下电缆并转到 Eclipse 并运行以在设备上安装应用程序;应该是这样的。
注意 2:断开或关闭无线模式:键入以下命令。应该说以 USB 模式重新启动 - 在此阶段 PC 和计算机不应使用电缆连接:
C:\Users\dell>adb usb
restarting in USB mode
注意 3:查找手机 IP 地址的步骤(取自 StackOverflow)
查找 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:My Phone Wi-Fi 连接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.bat 文件中的 IP 地址即可。
注意 6:这是一种蛮力方法,它消除了继续寻找 IP 地址和连接到 Eclipse/Wi-Fi 的所有人工劳动。
成功说明 7:简而言之,常规活动应该是这样的:
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