解决Android adb连接不上的问题。

即将毕业答辩,翻出半年前的代码,刚把IDE打开,就报了如下的错误
这里写图片描述

顿时把我惊到了,于是我打开任务管理,并没有发现有运行的adb.这可怎么办呢?于是我百度了一下,百度了很久,看了几个stack overflow的解决办法。W T F?.

You need to kill the adb process that is running, to do so,

Go to Spotlight search, open Activity Monitor,

Loop for adb under CPU tag,

Now Select it and Force Quit the process.

You can kill adb process through Terminal command too, by simply typing Kill -9 adb

Note: Sometimes When u tried to force close them they kept restarting. Make sure you quit any emulators and disconnect any devices to avoid any mistake.

根本解决不了,怎么办呢?看看国内的解决办法如下:
C:\Users\posuo>adb devices
* daemon not running. starting it now on port 5037 *
ADB server didn’t ACK
* failed to start daemon *
error: cannot connect to daemon

当出现如下的问题,说明你的adb的5037的端口被占用了。于是就可以按照下边的办法解决

现在命令行输入:
netstat -ano | findstr “5037” 这个命令是查找5037端口被那个占用
显示结果为TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 8516
紧接着输入命令:tasklist | findstr “8516”
显示结果为sjk_daemon 8516 Console 1 3,071 K
最后输入命令:tasklist
显示结果有为:Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
System 4 Services 0 1,128 K
sjk_daemon 963 Console 1 3,071 K
tasklist.exe 1260 Console 1 5,856 K

然后输入命令taskkill /f /pid 963 就可以关闭这个端口现在的进程了。
紧接着就可以运行你的adb了。

然后
W T F?
我的问题不是端口占用,而是:
Invalid argument: cannot open transport registration socketpair
could not read ok from ADB Server
failed to start daemon *
error: cannot connect to daemon

shit,于是又开始找方法,最终 苍天不负有心人,找到了最佳解决办法,就是把电脑的防火墙关闭,然后adb就可以运行了。。。。
具体怎么关防火墙,自行百度去吧。

现在记录此问题,以帮助有遇到相同坑的同学

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Fighting_Boss_Hao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值