0

I am using android emulator and when i send request to localhost it gives me error. I have tried the forwarding the port also ngrok but none of them worked for me. It always gives me error. [Error:Network Error].

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56

2 Answers2

0

IN Emulator go to setting->click on Network and Internet ->then select Internet->select available network and then re-run your project and check it will work

0

Please try http://10.0.2.2:8080 instead of localhost:8080.

If you are referring your localhost on your system from the Android emulator then you have to use http://10.0.2.2:8080/ Because Android emulator runs in a Virtual Machine therefore here 127.0.0.1 or localhost will be emulator's own loopback address.

Original Answer Source