如何从安卓模拟器连接到本地服务器? [英] How to connect to a local server from an android emulator?
本文介绍了如何从安卓模拟器连接到本地服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的电脑上启动一个本地服务器,IP 为 127.0.0.1,监听端口 3000.
Started a local server in my computer with IP 127.0.0.1 listening on port 3000.
但是,当我在 android studio 上运行模拟器时,我无法通过我的 android 应用程序访问它.我从我的应用程序的网络库收到超时错误,所以它没有建立连接.
However, I am unable to access it via my android app when I run the emulator on android studio. I got a timeout error from my app's networking library, so it is not making connection.
推荐答案
使用 IP 地址 10.0.2.2
.您可以在此处阅读更多信息.
Use the IP address 10.0.2.2
. You can read more at here.
这篇关于如何从安卓模拟器连接到本地服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文