16

I'm using Expo App in my Android Device to connect into the my Laptop's Expo (Signed in both my same Expo's Account)I am also connected in the same network. Then I scanned my code then after that it is unable to connect it. This is the error:

Uncaught Error:java.net.ConnectException: Failed to connect to localhost/178.0.0.1:190000

There is also an eror that I get in my Expo's Laptop:

enter image description here

Sometimes the URL is not the same. It should be same, right? How do I solve this. Thank you in advance!

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Liza Catherine Ombyaw
  • 804
  • 2
  • 11
  • 27

19 Answers19

32

First off make sure to turn off all of your anti-virus software including anything that has firewall protection. You have to do this on both your computer and your phone. It can be kind of a pain in the butt

Then try using the "Tunnel" connection for the type of connection. I had the same problem and that's how I finally got it to work on my phone.

Peter Cr
  • 441
  • 4
  • 6
  • 5
    Thanks ! 1 year later and "Tunnel" advice worked for me ! – Hans Sep 25 '20 at 16:10
  • 1
    "Tunnel" connection also helped me but how you will get that from Expo, that screenshot I have attached in the following url: https://ibb.co/3fj2FMN – Amzad Khan Jan 01 '22 at 18:18
  • The tunnel actually worked!! Thanks. – chai86 Mar 04 '22 at 15:53
  • 1
    What is the "Tunnel", how can config it?? – Nam Lee Sep 02 '22 at 15:43
  • 4
    @NamLêQuý: If you are using the latest expo cli, just start your project with `expo start --tunnel`. When asked `The package @expo/ngrok@^4.1.0 is required to use tunnels, would you like to install it globally?`, type Y. That's all. For an explanation of what tunneling does, please follow the following [link](https://makaidivyaswor.medium.com/expo-tunneling-application-for-the-world-to-use-a5eace341d6b). – RdC1965 Sep 08 '22 at 16:53
  • @NamLêQuý There used to be a web UI where you'd easily click a button for it, but now it's been taken out. So you have to use the command line now. See: https://blog.expo.dev/sunsetting-the-web-ui-for-expo-cli-ab12936d2206 – jaquinocode Feb 09 '23 at 01:09
9

If you're using Windows, make sure the network you are using is configured as a Private network. If it's set as a Public network, you will not be able to connect.

kaber
  • 91
  • 1
  • 1
  • 3
    If you don't want to turn your network to private, an option not recommended by Microsoft, you can always use the 'tunnel' option as suggested in other answers: `expo start --tunnel`. – RdC1965 Sep 09 '22 at 12:50
3

Steps I followed that solved my issue

  1. Restarted Router.
  2. Clear Expo Go data from settings
  3. Run expo start and everything working good now
Penny Liu
  • 15,447
  • 5
  • 79
  • 98
haidar
  • 1,449
  • 1
  • 11
  • 12
3

In my case the problem was in my phone, which didn't connect to same wifi, but instead used mobile internet. To check it you use modem mode on your phone and connect your computer by wifi to it. In this case you can be sure both devices connected via same net, and I hope it may solve the problem.

Ruslan Valeev
  • 1,529
  • 13
  • 24
1
  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.
0

I solved this issue by connecting the physical phone(That you are using to connect with the App) hotspot with the laptop instead of another Wifi.

0

sometimes shift+r is working. it clears cache

rufai demir
  • 446
  • 4
  • 8
0

For those who are using physical android device via cable, try to activate USB tethering on android and set the expo connection to local. It works for me. Hope it help someone in the future.

Tosca
  • 423
  • 7
  • 12
0

To solve this issue follow these steps:

  1. Update your expo cli by command npm install -g expo-cli
  2. Turn on your hotspot from mobile and connect it to your desktop or laptop.
  3. make sure the network is set to be private otherwise you will not be able to access the application.
  4. Login in expo from mobil as well as laptop from same account.
  5. now scan or manually tye the url in expo app and that will rendrer your app.
0

I had this problem with the newest expo-cli version (6.0.1), which does not seem to have the "tunnel" option anymore. The funny thing is that the device sometimes connects, but frequently not.

I downgraded to v5.5.1, and could connect again using the tunnel option.

RdC1965
  • 412
  • 5
  • 8
0

If you're using WSL(Windows Subsystem for Linux) like me and trying to run expo go via QRcode you generated in WSL; give it a try the same process in your Windows PowerShell. I applied the same steps and it worked this time.

Ozer Ozturk
  • 149
  • 1
  • 6
0

environment variable doesn't work for me, npx expo start --tunnel is useful

Aquairo
  • 1
  • 1
0

I was using a previous link like 172.something but now on my new network the expo link was like 192.something, so realizing changed networks and using correct link helped me.

0
npx expo start --tunnel                                              

In my case, solved with option --tunnel

https://docs.expo.dev/more/expo-cli/#server-url

M--
  • 25,431
  • 8
  • 61
  • 93
lorihori
  • 11
  • 1
  • 1
    Linked content is not considered part of an answer at StackOverflow. So your post does not contribute anything to the discussion that is not already in https://stackoverflow.com/a/74368572/7733418 Please [edit] to turn this into an answer according to [answer] or delete this and propose an edit on existing answers. – Yunnosch May 15 '23 at 13:00
0

i uninstalled expo on my phone and rebuilt android. it worked

Shelton
  • 31
  • 3
0

I don't why these answers are too complicated, I have very easy solution for this.

Try running your computer and mobile on same WI-FI network.

After executing the App.

just use EXPO app and try entering URL manually ..

URL should be exp://your_systems_IPv4_address:your_port

your_systems_IPv4_address : it can be in the format 192.168.0.1

port: it can be 19000 or 19001....

Thanks

Pandey
  • 19
  • 3
0

I upgraded my Expo SKD from 46 to 47 and my Android Expo Go, testing dev environment now works.

From my local project terminal, (MacOS Monterey, using VS Code) I ran this:

yarn add expo@^47.0.6

As of Expo Go Client version 2.29.1, Only SDKs 47, 48, 49 are supported.

-- Be sure to only upgrade Expo SKD Client versions one at a time, (DO NOT Skip versions, e.g. go from say 46 to 48).

Sourced: Upgrade Expo SDK -- (Link to Blog post for version 47 upgrade, recommends upgrading expo-cli with npm but since version 46 expo-cli was incorporated into expo and no longer installed globally but locally, I went with the above yarn add/update which worked like a charm.)

enter image description here

totallytotallyamazing
  • 2,765
  • 1
  • 20
  • 26
-1

tunnel is still your best bet if you ask me. i just fixed this same error using tunnel. and how to do it is very simple. go to your package json and where you have expo start add --tunnel to it, so it would look some thing like this: "script" : { "start" : "expo start --tunnel" } that would surely fix your issue, you can then use expo start -- tunnel or npm start, whichever you prefer

-2

I solved my issue by deleting the eas.json file. Now expo app is working fine.