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


当前回答

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

其他回答

这发生在我身上时,模拟器冻结,我必须杀死进程。信号图标总是显示屏幕截图中的小“x”,没有网络连接成功。

唯一有帮助的是卸载和重新安装模拟器(不是AVD图像)

在Android Studio中:

工具-> Android -> SDK管理器 取消选中“Android模拟器”,让它卸载,然后再次检查,让它重新安装。

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

然后进入SDK路径

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

它解决了你的网络问题…

我也有这个,我通过创建新的android模拟器虚拟设备解决了这个问题,并选择了Nexus 4 api 27。在我创建Pixel设备api 28之前,即使在重新创建设备后,它也无法工作。所以我尝试了完全不同的配置和Android模拟器有互联网连接的预期。其他的解决方案对我来说都不奏效,但我并没有尝试所有的方法。

解决这个问题最简单快捷的方法之一就是 选择API为29或以下的设备,对于互联网来说,更高的API会有一些问题。DNS的东西对我来说不起作用,所以我尝试降低设备API级别,chrome等开始工作。 然而,我的应用程序能够使用互联网,因为我们能够在更高的API上从后台获取数据,但有chrome测试其他一些功能的问题。

只需要用另一个目标API重新创建模拟器就可以了