问题
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!
回答1:
You shoud use next IP 10.0.2.2
回答2:
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
回答3:
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
来源:https://stackoverflow.com/questions/4529784/android-cannot-access-localhost