端口转发本地服务器到Expo Android模拟器

发布于 2025-02-10 23:58:52 字数 59 浏览 2 评论 0原文

我的笔记本电脑中有一台本地服务器。我想通过Android模拟器中的Localhost访问它。我该怎么做?

I have a local server running in my laptop. I want to access it via localhost in the android emulator. How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘初心 2025-02-17 23:58:52

您可以通过进入仿真器内的地址10.0.2.2从Android模拟器内部访问主机。

例如,如果您可以通过localhost:8080在本地计算机上访问Web服务,则可以通过

http://10.0.2.2:8080 

从模拟器内部键入相同的访问。有关模拟器网络的更多详细信息,您可以阅读在官方文档中

You can access host machine from inside the android emulator by going to the address 10.0.2.2 inside the emulator.

For example if you have a web service accessible on localhost:8080 on your local machine, you can access the same by typing

http://10.0.2.2:8080 

from inside the emulator. More details about emulator networking you can read in the official documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文