5

I am using windows 10 and expo 46.0.9. I was trying to have android emulator for expo app project. I installed Android studio and set the path in environment variables. When i run my app in VS code terminal using

npm run start 

and after metro bundling i pressed "a" for android. My AVD mobile appeared on screen but i got following error on the terminal.

Error: could not connect to TCP port 5554: cannot connect to 127.0.0.1:5554: No connection could be made because the target machine actively refused it. (10061)

I followed a youtube tutorial video. Youtube tutorial for emulator. I searched on google but could not find the solution for android studio for expo.

Current result Error picture

Expected results expected results

Ahtisham Ali
  • 61
  • 1
  • 2

5 Answers5

9

I found this solution in another post, try this (it worked for me):

I have just met this issue and noticed that it was happening due to the hanging ADB server. Mine has been solved by running the following commands:

adb kill-server
adb start-server
1

Just wipe the device data and remove node_modules package.

Then

npm install 
npm start

press A and wait it to install app.

(I just try this successfully)

MOLLY
  • 409
  • 2
  • 12
  • Yeah. It seems that wipe the data solves the problem. In my case I dropped the virtual device and create another. – Shad Dec 10 '22 at 13:34
0

Just code in the terminal

npm i

and wait for it to install all he required dependencies then restart the project using

yarn start or expo start

The.Kingslayer
  • 105
  • 1
  • 1
  • 8
0

I was struggling on this same issue for 3 days. I knew that something wrong with my port forwarding on 5554 but couldn't find a way to fix. Until I found this answer. https://stackoverflow.com/a/73136231/4122078

Most of article about running Expo or React Native don't mention about allowing a service in WSL to connect with an emulator on the Windows via emulator port.

Basically you can port-forwarding (which I believe it is) using socat. You can install by sudo apt-get install socat in WSL.

Then run socat -d -d TCP-LISTEN:5554,reuseaddr,fork TCP:$(cat /etc/resolv.conf | tail -n1 | cut -d " " -f 2):5554.

You need to change 5554 to be your emulator's port if it's running on another port. Checking an emulator's port by running adb devices.

Hope it helps someone who struggling this issue in the future.

chin8628
  • 446
  • 7
  • 15
0

in my case, just killing the adb process did the job

tikej
  • 179
  • 1
  • 16