如何将我的Android模拟器连接到互联网,例如使用浏览器?我已经找到了很多关于如何通过代理连接的建议,但这里不是这样,我的机器(Windows 7)是直接连接到路由器的。


当前回答

我的服务订单首选项是正确的(Wi-Fi是第一个),但仍然无法连接。

答案是,从霹雳桥转弯:

系统参数>网络>霹雳桥

然后将“配置IPv4”设置为“关闭”,并应用您的更改。

不需要在模拟器中摆弄访问点。

其他回答

检查你是否使用多个互联网连接到你的电脑,比如一个是局域网第二个是调制解调器,所以禁用所有的局域网或调制解调器。

如何设置Android模拟器的Internet选项?

这个问题有不同的解决办法。其中之一,我将向您展示我的实验和结果,使用最近的android studio和2017年下载的AVD图像。

你要做的第一件事是从android工作室启动你的AVD。(在我的情况下,我选择NEXUSAPI25安卓7.1图像) 转到设置->无线和网络->蜂窝网络->接入点->(+)按add ->输入以下如果你没有NTLM代理或代理在所有(这意味着你是直接连接) a.添加apn名称为myAPN B.添加apn服务器=> WWW C.保存并尝试浏览互联网。

如果这不起作用,在你的环境变量中添加“ANDROID_SDK_ROOT”

然后,使用模拟器命令启动AVD,如下所示

模拟器-avd Nexus25 -dns-server 8.8.8.8

对于那些使用NTLM代理的人,接下来我将向您展示它如何为我工作。 将Android_sdk_root路径添加到环境变量中。这使得命令行代码像使用AVD名称一样读取成功。 使用以下命令启动模拟器

>模拟器-avd Nexus_5X_API_25 -http-proxy http://username:password@ipaddress:端口

输入

I have Mac OS X 10.7.2, Eclipse Helios Service Release 2. I also work via Proxy and my IP settings are via DHCP. I solved this issue firstly using this article http://www.gitshah.com/2011/02/android-fixing-no-internet-connection.html, then I removed Emulator settings and just go to Run->Run Configurations->Target->Additional Emulator Command Line Options and type there -http-proxy xxx.xx.111.1:3128 . Also I would like to say that when I typed also a DNS like this: -dns-server xxx.xx.111.1 -http-proxy xxx.xx.111.1:3128 it did not work, but when I removed DNS it worked. Also I would like to note, that Additional Emulator Command Line Options are not visible without scrolling to the bottom of that window. I also want to note, that when you change emulator options, all apps will work. But If you write Additional Emulator Command Line Options, you need to write them every time for every app target in Run Configurations.

我以为我在连接模拟器到互联网时遇到了问题,但事实证明是我使用的代码有问题。我知道这是显而易见的,但首先在模拟器上尝试浏览器,以确认你没有互联网接入。如果我先做那件事,我就可以节省一个小时。

是的——在win7中使用管理员privs启动模拟器,一切都会很好——或者至少你会在android中获得无线。