Android Wifi 手机连接调试

来源:互联网 发布:页面静态化 java 编辑:程序博客网 时间:2024/04/30 07:59

首先一定要在手机上开启USB调试。。。。。


http://blog.csdn.net/kuanxu/article/details/7444874

上面博客里面讲到下面方法来wifi连接手机调试

1,  确认本机PC 没有任何adb 设备连接,包括模拟器和usb连接, 即 使用

“adb devices” 命令后, 列表显示为空, 这个是为了后面敲命令容易一些

2,  将远程android设备接入wifi, 并查看其IP地址:设置—〉无线或网络---〉WLAN设置—〉按menu键并选择“高级”选项---〉IP 地址  例如192.168.2.11

3,  本机command 命令下执行 ping  192.168.2.11, 如果ping成功,说明可以连接

4,  执行 adb connect 192.168.2.11

如果显示连接成功,则可继续执行后面的操作;如果不成功,如显示:

unable to connect to 192.168.2.11:5555

有可能是设备监听端口的问题,则可以在手机终端执行如下命令:

su  //获取root权限

setprop service.adb.tcp.port 5555   //设置监听的端口,端口可以自定义,如5554,5555是默认的

stop adbd   //关闭adbd

start adbd   //重新启动adbd

结果我的总是cannot connect 

最后上google搜索setprop service.adb.tcp.port 5555在下面链接里找到了答案

http://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp

From a Computer, if You Have USB Access Already

It is even easier to switch to using WiFi, if you already have USB access. From a command line on the computer that has the device connected via USB, issue the commands

adb tcpip 5555adb connect 192.168.0.101:5555

Be sure to replace 192.168.0.101 with the IP address that is actually assigned to your device.

To tell the ADB daemon return to listening over USB

adb usb

0 0
原创粉丝点击