I am using mac and Expo 4.4.4.
When I am trying to run Expo on Android Emulator Getting below error :
Couldn't start project on Android: could not connect to TCP port 5554: Connection refused
I tried the below cmds in the terminal to get rid of offline device
$ adb devices
List of devices attached
emulator-5554 offline
emulator-5556 device
$ adb kill-server
$ adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
$ adb devices
List of devices attached
emulator-5554 offline
emulator-5556 device
$ lsof -i :5555
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
adb 13691 sujayun 9u IPv4 0xd716e907b32c7e05 0t0 TCP localhost:54347->localhost:personal-agent (ESTABLISHED)
$ kill -9 13691
$ adb devices
List of devices attached
emulator-5554 offline
emulator-5556 device
What ever I try, I am not able to rid of offline device.
Is there any way to remove this ? or start expo on TCP 5556 ?
After battling for 3 days found the issue and solved it.
I checked with all processes listening on different ports
$ sudo lsof -i -P | grep LISTEN
launchd 1 root 11u IPv6 0x19938282208649b9 0t0 TCP *:5900 (LISTEN)
kdc 196 root 5u IPv6 0x1993828220866e79 0t0 TCP *:88 (LISTEN)
wftpserve 383 root 7u IPv6 0x1993828220864399 0t0 TCP *:5555 (LISTEN)
wftpserve 383 root 8u IPv4 0x199382822086dee9 0t0 TCP *:5555 (LISTEN)
mDNSRespo 285 _mdnsresponder 82u IPv4 0x19938282276928c9 0t0 TCP *:53 (LISTEN)
MEGAclien 546 root 32u IPv4 0x1993828225a7e8c9 0t0 TCP localhost:6341 (LISTEN)
adb 1064 root 12u IPv4 0x19938282279288c9 0t0 TCP localhost:5037 (LISTEN)
Check with the service whose TCP is listening on 5554 + 1 = 5555
This service might be causing the automatic start of the offline emulator
Kill that process with PID,
In my case it was wftpserve service with PID 383
$ sudo kill -9 383
Then the emulator disappeared
$ adb devices
List of devices attached
Then Expo started on my Android emulator