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


当前回答

我知道这很旧了。但它帮了我一点忙。我在Xamarin遇到了同样的问题。表单应用程序。我的模拟器无法连接到公共api。

我通过在Android设备管理器中使用出厂默认设置启动模拟器来解决这个问题。

其他回答

提醒:如果您打开计算机上的VPN系统,Android模拟器的互联网连接将无法工作。

适用于苹果MacBook M1用户

自2022年2月1日起生效

Android模拟器 转到扩展控制。 然后进入代理(Tab)下的设置, 使用Android studio HTTP代理设置 单击Apply 重新启动/冷启动模拟器。

这将修复模拟器上的互联网连接问题。

MacOS解决方案,不为整个机器使用自定义DNS

步骤1

找到Android Studio在Android SDK中使用的模拟器可执行文件,并将其重命名为simulator -original。

我的位于/usr/local/share/android-sdk/emulator/emulator,但它可能会根据个人设置而有所不同。

步骤2

在包含以下命令的原始文件(或使用您选择的DNS服务器)的位置添加一个名为emulator的新文件。

#!/bin/bash
$0-original "$@" -dns-server 8.8.8.8

步骤3

使新的模拟器文件可执行。

chmod +x emulator

步骤4

使用Android Studio重新启动模拟器。

我有visual studio 2017,这简单的几次点击已经修复了Android模拟器的互联网问题。

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