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文件夹并创建一个新的。看来文件损坏了

如果您的网络上有PiHole,请确保您的Pi正在工作,并且您可以访问PiHole的web UI。每一次,当我的模拟器突然无法连接到互联网时,都是因为它们中的任何一个出了问题。

请点击下面的链接。

https://developer.android.com/studio/run/emulator-networking

打开模拟器,点击更多…,然后单击“设置和代理”。从这里,您可以定义自己的HTTP代理设置。

输入主机名 执行> cmd > hostname

最后,通过chrome浏览器或谷歌检查模拟器内部的网络访问。

注意:经常擦数据就会清除这个问题。请遵循所有步骤

我在升级到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环境变量,则可以缩短上面的命令,但我建议在这样做时要谨慎。

当我在从家里到咖啡馆的路上一直开着模拟器时,我就遇到了这个问题。“冷启动现在”修复了这个问题。