'Can't connect my Android Phone in Expo React Native Project

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!



Solution 1:[1]

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.

Solution 2:[2]

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.

Solution 3:[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

Solution 4:[4]

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.

Solution 5:[5]

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.

Solution 6:[6]

sometimes shift+r is working. it clears cache

Solution 7:[7]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Cr
Solution 2 kaber
Solution 3 Penny Liu
Solution 4 Ruslan Valeev
Solution 5 Niharika Sharma
Solution 6 rufai demir
Solution 7 Tosca