adb重启的方法


执行以下命令:

D:\android-sdks\platform-tools>adb kill-server --停止adb服务
D:\android-sdks\platform-tools>adb start-server --开启adb服务

如果启动失败则可查看占用5037端口的程序,并将其进程结束掉即可

netstat -ano | findstr "5037" --查找占用端口号5037的连接

TCP 127.0.0.1:58440 127.0.0.1:5037 ESTABLISHED 2376

进程ID2376占用了端口号,用以下命令查看进程名称
最后打开任务管理器,将对应的进程结束,重启adb:adb start-server

tasklist | findstr "2376" --查找进程ID为2376的进程

PS C:\Users\22073\Desktop> adb start-server
adb server version (31) doesn't match this client (41); killing...
could not read ok from ADB Server
* failed to start daemon
error: cannot connect to daemon
PS C:\Users\22073\Desktop> adb start-server '
>> wefew
>> w^C
PS C:\Users\22073\Desktop> adb start-server
adb server version (31) doesn't match this client (41); killing...
could not read ok from ADB Server
* failed to start daemon
error: cannot connect to daemon
PS C:\Users\22073\Desktop> ^C
PS C:\Users\22073\Desktop> netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       17988
  TCP    127.0.0.1:5037         127.0.0.1:56321        ESTABLISHED     17988
  TCP    127.0.0.1:5037         127.0.0.1:56383        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56386        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56387        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56388        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56389        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56390        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56393        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56394        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56395        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56396        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56397        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56398        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56399        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56400        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56401        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56402        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56404        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56406        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56407        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56408        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56409        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56410        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56411        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56413        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56414        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56415        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56418        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56420        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56421        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56422        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56423        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56424        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56426        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56427        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56428        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56429        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56430        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56431        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56432        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56433        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56449        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56453        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56475        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56593        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56606        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56623        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56626        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56628        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56629        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56630        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56631        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56632        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56633        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56636        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56638        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56639        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56646        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56648        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56696        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:56714        TIME_WAIT       0
  TCP    127.0.0.1:56321        127.0.0.1:5037         ESTABLISHED     8368
  TCP    127.0.0.1:56617        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:56634        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:56635        127.0.0.1:5037         TIME_WAIT       0
PS C:\Users\22073\Desktop> tasklist | findstr "1798"
360MobileMgr.exe             17988 Console                    1      6,736 K
PS C:\Users\22073\Desktop>

转载于:https://blog.51cto.com/haidragon/2397530

你可能感兴趣的:(adb重启的方法)