ADB
来进行连接,而我们将要通过ADB
来完成效果。我就开着酷狗听歌,导致一直实现不成功,正是纳闷,后面想了下,才知道是这个原因。 usb
调试的模式,跟平常使用usb调试程序一样的步骤。2.进入android-sdk的文件夹,就是平时要你重启adb
的地方,即:platform-tools
,我的地址为
d/adt-bundle-windows-x86_64-20131030/sdk/platform-tools
3.打开命令行(win+r,输入cmd)
adb tcpip 5555
以上这一句话的意思是adb
从usb
模式转化成adb
网络模式(wifi
)
命令行相应出现:restarting in TCP mode port: 5555
,代表执行成功
你会发现,手机顶端不在出现原先有的图标
4.使电脑连接手机的wifi的地址
打开手机连接wifi的地方,并得到wifi的地址。我的为:
192.168.1.129
接着在上次一个步骤的命令行中输入
adb connect 192.168.1.129
出现:connected to 192.168.1.129:5555
代表执行成功
5.现在你可以断开usb
线了(其实在第三步后,就可以断开了),然后像往常run
一个应用程序,即可。
usb
试调模式呢?也就是还原呢。adb usb
出现:restarting in USB mode 说明成功。
还原原来的状态。
同开发者选项没有网络ADB调试的系统一样的操作。你会发现
adb tcpip 5555
error: more than one device and emulator
和
adb connect 192.168.1.106
unable to connect to 192.168.1.106:5555
原因是你没有启动网络ADB调试。启动网络ADB调试,再试一遍即可。
adb tcpip 5555
restarting in TCP mode port: 5555
和
adb connect 192.168.1.106
connected to 192.168.1.106:5555
最后,不必使用adb usb
将模式调回来,只需要关掉网络ADB调试即可。
adb tcpip 5555
error:
和
adb connect 192.168.1.106
error:
这些情况是adb
被占用了,你需要将他杀掉,然后重启
adb.exe kill-server
adb start-server
或者,情况比较悲剧,你的android系统没有安装一些必要的属性。下载msysgit,这个有什么好处呢?能用git
,另外是能执行一些linux
的命令来运行Linux shell。然后运行脚本来配置属性。
E盘新建一个文件命名为adbTowifi.sh
#!/bin/bash #Modify this with your IP range #这里的ip要注意,我的是MY_IP_RANGE="192\.168\.1",这里要看你的具体ip地址决定 MY_IP_RANGE="192\.168\.43" #You usually wouldn't have to modify this PORT_BASE=5555 #List the devices on the screen for your viewing pleasure adb devices echo #Find USB devices only (no emulators, genymotion or connected devices declare -a deviceArray=(`adb devices -l | grep -v emulator | grep -v vbox | grep -v "${MY_IP_RANGE}" | grep " device " | awk '{print $1}'`) echo "found ${#deviceArray[@]} device(s)" echo for index in ${!deviceArray[*]} do echo "finding IP address for device ${deviceArray[index]}" IP_ADDRESS=$(adb -s ${deviceArray[index]} shell ifconfig wlan0 | awk '{print $3}') echo "IP address found : $IP_ADDRESS " echo "Connecting..." adb -s ${deviceArray[index]} tcpip $(($PORT_BASE + $index)) adb -s ${deviceArray[index]} connect "$IP_ADDRESS:$(($PORT_BASE + $index))" echo echo done adb devices -l #exit
在E
盘,鼠标右键打开Git Bash here
,然后输入
sh adbwifi.sh
出现以下效果:
说明已经成功,这时你需要重复步骤进行配置就可以了。