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


当前回答

这个问题有不同的解决办法。其中之一,我将向您展示我的实验和结果,使用最近的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 think some of the answers may have addressed this, however obliquely, but here's what worked for me. Assuming your problem is occurring when you're on a wireless network and you have a LAN card installed, the issue is that the emulator tries to obtain its DNS settings from that LAN card. Not a problem when you're connected via that LAN, but utterly useless if you're on a wireless connection. I noticed this when I was on my laptop. So, how to fix? Simple: Disable your LAN card. Really. Just go to your Network connections, find your LAN card, right click it and choose disable. Now try your emulator. If you're like me, it suddenly ... works!

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

答案是,从霹雳桥转弯:

系统参数>网络>霹雳桥

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

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

读完这篇文章后,我决定看看我的“网卡”。我把它放在引号里,因为像许多人一样,我正在为Hamachi和virtual Box等设备运行虚拟网卡。在我禁用了Hamachi之后,我可以使用互联网了。我的猜测是模拟器选择第一个可用的nic,而不管它是否是虚拟的。现在来看看我是否可以重新安排我的nic订单而不撕裂我的盒子。

Windows 7 32位

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.

如果您在SDK管理器的工具->选项下是代理,则不要配置代理设置。 当你从命令行运行时,添加-http-proxy:

emulator.exe -avd YOUR_AVD_NAME_HERE -http-proxy PROXY:PORT

为我工作。