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".


当前回答

我也面临着同样的问题,但我试图通过各种帖子来解决这个问题。今天我发现了这个问题。问题很可能出在你的电脑配置上,而不是Android Studio和Android模拟器。

问题来自您的网络设置。只要将主DNS服务器设置为8.8.8.8,就可以解决问题。

其他回答

设置DNS 8.8.4.4 然后运行模拟器-avd react-native-device -dns-server 8.8.4.4

这对我很有用

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

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

冷启动选项适合我

我在升级到SDK 2.3的旧Stack Overflow线程上找到了一个临时解决方案-现在没有模拟器具有连接性。注意,本文讨论的是Android SDK 2.3,而不是Android Studio 2.3。问题似乎是模拟器无法找到我的计算机当前正在使用的DNS,临时的解决方法是从命令行启动模拟器并指定DNS服务器。无论当时发生了什么问题,一定会在最新版本的Android Studio中重新出现。

下面概述的临时解决方案修复了模拟器访问internet的问题。但是,它并没有修复试图运行Android设备监视器时发生的问题。这样做仍然会使模拟器脱机,如上所述。

注意,在sdk中有两个名为“模拟器.exe”的文件——一个在sdk\tools下,另一个在sdk\emulator下。任何一个都可能在下面工作,但我使用sdk\emulator下的一个。

第一步是找到SDK的位置。假设用户名为“jdoe”,并且在Windows上默认安装了Android Studio,那么SDK很可能在

C:\Users\jdoe\AppData\Local\Android\sdk

第二步是确定要运行的AVD(模拟器)的名称。命令

C:\Users\jdoe\AppData\Local\Android\sdk\emulator\emulator.exe -list-avds

将显示avd的名称。在我的计算机上,它只显示了一个,Nexus_5X_API_25。

要使用指定的DNS服务器从命令行启动模拟器,可以使用如下命令:

C:\Users\jdoe\AppData\Local\Android\sdk\emulator\emulator.exe -avd Nexus_5X_API_25 -dns-server 8.8.8.8

在此例中,8.8.8.8为谷歌公共域名服务器。

如果创建适当的环境变量并编辑PATH环境变量,则可以缩短上面的命令,但我建议在这样做时要谨慎。