如何将我的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:端口

输入

其他回答

您尝试过使用管理权限启动模拟器吗?它适用于我,我运行的是Windows 7 64bit)

在尝试了以上所有的解决方案后,我发现在mac os x上:

您必须在系统首选项>> network >> gear图标中检查网络设备的顺序 您必须在/etc/resolv.conf中检查DNS服务器的顺序

然后重新启动你的android模拟器,它应该工作。

如果你用的是Mac,试试这个

去苹果图标->系统首选项->网络 点击齿轮图标,选择“设置服务订单” 将活动接口置于其他接口之前。 重新启动Android模拟器。

我也有类似的问题。我安装了一个需要INTERNET权限的应用程序(并使用了它),然后突然就工作了。

朋友们,还要检查一下你是否在某个地方没有通过VPN连接,因为它也会干扰互联网连接。

blacharnia

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.