5

When I run my expo/react-native project and want to run it on my android phone through the expo go app, it gives me a connection error:

"Uncaught Error: java.net.SocketTimeoutException: failed to connect to /192.168.2.18 (port 19000) from /192.168.2.9 (port54394) after 10000ms"

error image

  • windows 10
  • node v16.18.1
  • expo 46.0.9
  • react-native 0.69.6

From help from multiple resources I've tried the following things, but nothing worked:

  • made sure phone and laptop are on same network
  • Add inbound rule in windows firewall to allow port 19000
  • disabled windows firewall
  • Changed network profile to Private.
  • set REACT_NATIVE_PACKAGER_HOSTNAME to the ipv4 address
  • run expo start --tunnel, this works. But not the best solution because it slows everything down
  • Connected phone through USB to laptop. Developer mode is on, enabled USB debugging and tethering.
  • run sudo ufw allow 19000/tcp
  • entered "10" as interface metric for Internet Protocol Version 4
  • removed .expo to clear cache(?)
  • I also have a mac, if I run it on there it works and can connect to it / open the app just fine.
Jelmer Overeem
  • 359
  • 1
  • 10
  • Hi have you found a solution to your problem? I'm running into the same issue. – maxtenzin May 24 '23 at 12:46
  • @maxtenzin I forwarded my ipv4 address to the WSL ip address where the expo app is running on. Using this guide: https://learn.microsoft.com/en-us/windows/wsl/networking#accessing-a-wsl-2-distribution-from-your-local-area-network-lan Let me know if this is not enough and you're still stuck. – Jelmer Overeem May 25 '23 at 13:08

1 Answers1

0
  1. If you are using a cellular network and connecting your laptop through the same mobile hotspot, ensure your connection is set to public on your laptop.
  2. If your laptop and mobile are connected to wi-fi, the connection must be private.