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".
当前回答
经过10天的麻烦,我刚刚删除了C:\Android\中的所有内容。并且删除了所有创建的avd。现在互联网似乎工作得很好。
其他回答
我也有这个,我通过创建新的android模拟器虚拟设备解决了这个问题,并选择了Nexus 4 api 27。在我创建Pixel设备api 28之前,即使在重新创建设备后,它也无法工作。所以我尝试了完全不同的配置和Android模拟器有互联网连接的预期。其他的解决方案对我来说都不奏效,但我并没有尝试所有的方法。
专业提示:在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
“移动数据”设置需要打开。冷启动不起作用,但在我打开移动数据后它起作用了吗
去你的适配器设置,将DNS更改为8.8.8.8,也就是谷歌,它会工作,它对我来说很有效
只需要用另一个目标API重新创建模拟器就可以了
推荐文章
- 改变开关的“开”色
- 以编程方式将EditText的输入类型从PASSWORD更改为NORMAL,反之亦然
- 如何在隐藏和查看密码之间切换
- 在Android上调整一个大的位图文件到缩放输出文件
- 如何更改Android版本和代码版本号?
- Android Studio突然无法解析符号
- 应用程序重新启动而不是恢复
- 如何设置整个应用程序在纵向模式?
- Android中文本的阴影效果?
- 以编程方式设置TextView的布局权重
- Android -如何覆盖“后退”按钮,所以它不完成()我的活动?
- 如何从通知点击发送参数到一个活动?
- 导航目标xxx对于这个NavController是未知的
- 使用ConstraintLayout均匀间距的视图
- 文件google-services错误。模块根文件夹中缺少Json。谷歌服务插件没有它就不能正常工作。