[转]Android使用WIFI进行远程ADB调试

1.确保你的手机已经有root权限

2.先用USB先连接手机,运行adb shell,
# mv /dev/android_adb /dev/android_adb.bak
(Android 是默认的ADB是使用 USB 作为debug,可以参考代码gdb.c, 重命名这个文件后,adb会尝试使用网络连接。)

# setprop persist.service.adb.enable 1
# setprop service.adb.root 1
# setprop ctl.stop adbd
# setprop ctl.start adbd
(设置adb为root权限并重启服务)

3.
# netstat
...
tcp        0      0 0.0.0.0:5555           0.0.0.0:*              LISTEN
...
(此时如果显示 tcp 5555 端口开启表明手机端的设置已经成功了。)

4.设置PC环境变量
export ADB_TRACE=adb
export ADBHOST=your.mobilephone.ip.address:5555
并将android sdk tools的路径添加到PATH中

5.拔掉USB线,在PC上直接运行adb命令,已经通过wifi连接到你的设备了
$adb connect your.mobilephone.ip.address
$ adb devices
adb_query: host:devices
_adb_connect: host:version
writex: 3 0xbfb7eb73 4: 30303063  000c
writex: 3 ok
writex: 3 0x8061003 12: 686f73743a76657273696f6e  host:version
writex: 3 ok
readx: 3 0xbfb7eb27 4
readx: 3 ok: 4f4b4159  OKAY
readx: 3 0xbfb7ebf4 4
readx: 3 ok: 30303034  0004
readx: 3 0xbfb7ebf4 4
readx: 3 ok: 30303161  001a
_adb_connect: host:devices
writex: 3 0xbfb7eb73 4: 30303063  000c
writex: 3 ok
writex: 3 0xbfb80d58 12: 686f73743a64657669636573  host:devices
writex: 3 ok
readx: 3 0xbfb7eb27 4
readx: 3 ok: 4f4b4159  OKAY
readx: 3 0xbfb7ec97 4
readx: 3 ok: 30303135  0015
readx: 3 0x8a3e008 21
readx: 3 ok: 656d756c61746f722d35353534096465  emulator-5554.de
List of devices attached
emulator-5554    device

(显示的虽然是emulator-5554,但实际上是你的手机设备)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7232789/viewspace-722444/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7232789/viewspace-722444/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值