如何从 Android Emulator 连接到我的 http://localhost Web 服务器

如何从 Android Emulator 连接到我的 http://localhost Web 服务器

问题描述:

我可以在 Android 模拟器中做什么以将其连接到位于 http://localhosthttp://127.0.0.1 的我的本地主机 Web 服务器页面?

What can I do in the Android emulator to connect it to my localhost web server page at http://localhost or http://127.0.0.1?

我已经尝试过了,但是模拟器仍然像谷歌搜索本地主机一样接受我的请求,或者更糟的是它说它在我的网络服务器正常运行时没有找到页面.

I've tried it, but the emulator still takes my request like a Google search for localhost or worse it says that it didn't found the page while my web server is normally running.

本地主机是指运行代码的设备,在本例中是模拟器.

The localhost refers to the device on which the code is running, in this case the emulator.

如果您想引用运行 Android 模拟器的计算机,请改用 IP 地址 10.0.2.2.

If you want to refer to the computer which is running the Android simulator, use the IP address 10.0.2.2 instead.

您可以从此处阅读更多信息.

You can read more from here.