echo
echo

Reputation: 799

Android cannot access localhost?

I started a local http server on Android and it can be reached by other computers in the same local network. But if I try to access this server using opera on the same phone, it won't work. So this means we are not able to access localhost on Android? Thanks!

Upvotes: 8

Views: 12413

Answers (4)

Maxim
Maxim

Reputation: 486

In my case I could not reach localhost from physical device, so only intercepting traffic via USB using adb helped:

https://stackoverflow.com/a/77634616/8705119

Upvotes: 0

user3583986
user3583986

Reputation: 1

Try to use your ip address in your pc (ipconfig to see the ip address for your pc)

IPv4 Address. . . . . . . . . . . : 192.168.1.12

So, use: 192.168.1.12:3000

Upvotes: -1

Thillai Narayanan
Thillai Narayanan

Reputation: 4896

Just check this http://developer.android.com/guide/developing/devices/emulator.html#networkaddresses

If ur app running in localhost:3000, then try to use as 10.0.2.2:3000 in your android emulator

Upvotes: -1

Yaroslav Boichuk
Yaroslav Boichuk

Reputation: 1775

You shoud use next IP 10.0.2.2

Upvotes: 6

Related Questions