How to connect to localhost from Android Studio emulator

前端 未结 2 695
臣服心动
臣服心动 2021-01-19 02:47

I am trying to test web application in Android 2.3.3 browser. Connection using http://10.0.2.2 results \"web page is unavailable\". Nothing found in

相关标签:
2条回答
  • 2021-01-19 03:35

    I use my local ip for that i.e. 192.168.0.1 and it works. Verify your local IP.

    0 讨论(0)
  • 2021-01-19 03:45

    You're going to need to connect to your computer's IP.

    If you're on Windows open CMD and type ipconfig this will give you your local IP.

    If you're on Linux or OSX open terminal and use the ifconfig command.

    Since the emulator is a full Android device it has its own network and doesn't use the same hosts file that your machine has. Along with its own IP.

    Edit: Grammar fix.

    0 讨论(0)
提交回复
热议问题