I know that similar questions have been asked before, but my problem is new only after installing Android Studio 2.3, the latest version in March 2017. I have several years experience developing Android applications, and I have never encountered this problem before. After upgrading to version 2.3 of Android Studio, my emulator is no longer able to access the internet. I even uninstalled/reinstalled Android Studio 2.3 from scratch and created a new emulator, and I am still getting the same error. This is not an app problem. I can't even access the internet from Chrome, and I wasn't having this problem last week. The message that I get says that the server DNS address could not be found -- DNS_PROBE_FINISHED_BAD_CONFIG. The only thing that has changed on my computer in the last week is the new version of Android plus possibly updates to Windows 10. And yes, my computer has access to the internet. Below is an image of my emulator when I try to use Chrome to search for "Google".


当前回答

专业提示:在Linux上使用AVD和dnsmasq

要理解你,请阅读从Android Studio设置Android模拟器网络。

被模拟设备的环回为127.0.0.1,可以从10.0.2.2访问被模拟设备的主机环回。

在启动时,模拟设备通过从/etc/resolv.conf中的主机中选择DNS名称服务器来设置它的DNS名称服务器。

但重点是,如果你正在使用dnsmasq,你setnameserver 127.0.0.1in/etc/resolv.conf ',所以模拟设备将击中它自己的环回,那里没有任何运行,而不是主机环回,那里有一个DNS服务器运行。

在命令行下运行AVD时,需要添加-dns-server。

例如:

云耀斑DNS: ~/Android/Sdk/模拟器- avdk_nexus_9_api_23 - DNS -服务器1.1.1 主机dnsmasq: ~/Android/Sdk/模拟器- avdd Nexus_9_API_23 -dns-服务器1.0.2.2

其他回答

我在升级后遇到了同样的问题。在模拟器中打开Chrome浏览器后,无法再访问google.com。

我在SO上找到了一篇文章,指出问题是模拟器试图使用一个断开连接的网络适配器。对我来说,这个问题是在我连接到局域网时发生的。禁用无线局域网适配器解决了这个问题。

禁用适配器。

导航到网络连接 找到适配器 右键单击并选择禁用

经过10天的麻烦,我刚刚删除了C:\Android\中的所有内容。并且删除了所有创建的avd。现在互联网似乎工作得很好。

在8.8.8.8更新我的WIFI适配器以解析DNS为我解决了这个问题。这是在苹果的一次更新搞乱了DNS地址之后发生的。

也许你为Android Studio设置了代理,但代理不起作用。尝试没有代理。

android浏览器是否可以访问Internet 你可以从终端运行模拟器 通过此命令

然后进入SDK路径

$ /工具/ avd模拟器 下一个是5x_api_23 -netdelay no -netspeed full

它解决了你的网络问题…