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模拟器,进入扩展控件。然后进入setting => proxy(Tab),取消勾选“Use Android studio HTTP proxy setting”,点击“Apply”。
其他回答
Android 9+模拟器适合我,但Android 7不能连接到互联网。
我办公室用的是小飞贼应用防火墙。我把它关掉了,Android 7运行正常。检查一下防火墙可能是个好主意。
对于这个问题,我有一个简单而永久的解决方案。
进入网络和互联网选项->
点击以太网或wifi(你连接的)选项->
单击更改适配器选项->
右键单击已连接的网络。
将打开一个对话框,只需单击Internet协议版本(TCP/IPv4)选项。
弹出另一个对话框,忽略第一组IP地址(保持不变),单击“使用以下DNS服务器地址:”单选按钮,在“首选DNS服务器:”和“备选DNS服务器”中分别输入8.8.8.8和8.8.4.4:
现在你可以随时打开你的模拟器,你会得到互联网在安卓模拟器。
这些答案对我都没用。我可以通过下载“android-studio-2021.1.1.8-mac_arm”来让它工作。之后就不需要额外的步骤了。
专业提示:在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
推荐文章
- BottomSheetDialogFragment的圆角
- 在应用程序启动时出现“无法获得BatchedBridge,请确保您的bundle被正确打包”的错误
- 我如何改变默认对话框按钮的文本颜色在安卓5
- 更改单选按钮的圆圈颜色
- 如何在android中复制一个文件?
- adb找不到我的设备/手机(MacOS X)
- 如何在新的材质主题中改变背面箭头的颜色?
- androidviewpager与底部点
- 相同的导航抽屉在不同的活动
- 如何从视图中获得托管活动?
- 单一的TextView与多种颜色的文本
- 如何在非活动类(LocationManager)中使用getSystemService ?
- 在清单中注册应用程序类?
- Android:从数组中编程创建旋转器
- Android命令行工具sdkmanager总是显示:警告:无法创建设置