搭完 Appium 环境, 用selendroid-test-app-0.10.0.apk 跑示例代码时报如下错误:
info: [ADB] Forwarding system:8080 to device:8080
debug: executing: "C:automationAndroidandroid-sdkplatform-toolsadb.exe" -s 4d003f5656e16051 forward tcp:8080 tcp:8080
warn: killed=false, code=1, signal=null
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: error: cannot bind to socket
info: Error: Command failed: error: cannot bind to socket
at ChildProcess.exithandler (child_process.js:647:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
stady(回复于:2018-03-30 10:03:10)
原因:
selendroid 需要8080 端口, 而该端口被其他进程占用。
解决方法:
找到占用该端口的进程然后 kill 掉
C:>netstat -ano | findstr 8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 1888
如上, PID 为1888 的进程占用了8080 端口, 打开任务管理器 kill 了该进程, 完成。