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].
Asked
Active
Viewed 137 times
0

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

Semir Hamid
- 17
- 5
-
consider removing flutter tag while it is not releated to this – Md. Yeasin Sheikh Feb 07 '23 at 00:22
2 Answers
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

komal harmale
- 28
- 9
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

Tharaka Ananda
- 66
- 4