首页 > 代码库 > Appium 连手机失败Error: Android bootstrap socket crashed: Error: getaddrinfo ENOTFOUND localhost undefined:4724

Appium 连手机失败Error: Android bootstrap socket crashed: Error: getaddrinfo ENOTFOUND localhost undefined:4724

问题:Appium执行,连接手机报下面的错误

Error: Android bootstrap socket crashed: Error: getaddrinfo ENOTFOUND localhost undefined:4724
    at Socket.<anonymous> (lib/bootstrap.js:87:21)
    at emitOne (events.js:90:13)
    at Socket.emit (events.js:182:7)
    at connectErrorNT (net.js:994:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
 

解决方法:

在hosts文件中增加【127.0.0.1 localhost】
 
(mac和linux中hosts文件目录:/etc/hosts)

Appium 连手机失败Error: Android bootstrap socket crashed: Error: getaddrinfo ENOTFOUND localhost undefined:4724