error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048)
记录一次在执行UI自动化脚本是报错error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048)的问题排查
首先在dos下执行adb devices 可以正常启动adb
C:\Users\N-319>adb devices
List of devices attached
88124c4 device
但是在运行UI自动化脚本时中途会报错error: could not install smartsocket listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 (10048)。
查看端口占用情况netstat -aon|findstr 5037
C:\Users\N-319>netstat -aon|findstr 5037
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 7128
TCP 127.0.0.1:50372 127.0.0.1:50373 ESTABLISHED 8412
在任务打开任务管理器查看进程,发现就是adb
杀掉adb进程发现路径已我配置的环境变量不一致,我环境变量里是C:\android-sdk-windows\platform-tools
adb kill
C:\Users\N-319>adb kill
Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as C:\Windows\system32\adb.exe
才想起来之前我安装过adb,并把adb.exe放在了C:\Windows\system32下,是不需要配置环境变量的,删除C:\Windows\system32下的adb.exe。端口占用问题解决
第一次写有不对的地方多多指教。