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".
当前回答
第一:开启飞行模式。 第二:连接模拟器wifi。
其他回答
在我的情况下,它是查尔斯代理应用程序。即使关闭应用程序,模拟器仍然不能访问互联网。需要停止监听查尔斯的网络。
关闭模拟器并重新打开对我来说很有效
OS WINDOWS 10
请点击下面的链接。
https://developer.android.com/studio/run/emulator-networking
打开模拟器,点击更多…,然后单击“设置和代理”。从这里,您可以定义自己的HTTP代理设置。
输入主机名 执行> cmd > hostname
最后,通过chrome浏览器或谷歌检查模拟器内部的网络访问。
注意:经常擦数据就会清除这个问题。请遵循所有步骤
在尝试了许多这些解决方案之后,我打算删除我当前的AVD并重新制作它,但当我点击AVD上的向下箭头时,我注意到“现在冷启动”。
一时兴起,我试了一下。瞧,我的模拟器又有互联网连接了!
命令行方式
如果你通过命令启动模拟器,传递-no-snapshot-load选项,比如:
%ANDROID_HOME%/emulator/emulator.exe -netdelay none -netspeed full -no-snapshot-load -avd Pixel_2_API_28
或者MacOSX:
$ANDROID_HOME/emulator/emulator -netdelay none -netspeed full -no-snapshot-load -avd Pixel_2_API_28
注意,您可能需要更改-avd Pixel_2_API_28部分(与您自己的虚拟设备名称)。 此外,大多数工具使用ANDROID_HOME环境变量名,因此定义它(如果还没有),但现在ANDROID_ROOT是另一个命名选项。
决定(编辑)
对于那些说为什么不擦除数据重新启动的人。 你每次重启电脑时都重新格式化吗?擦除模拟器上的数据就像对手机进行出厂重置或重新格式化PC上的硬盘驱动器并重新安装操作系统。除非数据完全损坏,否则这是不必要的。
当你关闭模拟器并重新启动它时,它就像将你的电脑置于休眠或睡眠模式。记忆不是被抹去,而是被保存。
冷启动和重启手机或电脑是一样的。它可以重置内存并重新加载。这允许网络模拟以干净的内存启动并正确连接。
所以,不要擦除数据。只是冷启动。如果还是没用,那就擦一下,但要留作最后的手段。
我突然在我的MAC上遇到了同样的问题。在尝试了所有方法之后,我终于删除了/Users/Philippe/文件夹。并创建一个新的模拟器。
推荐文章
- BottomSheetDialogFragment的圆角
- 在应用程序启动时出现“无法获得BatchedBridge,请确保您的bundle被正确打包”的错误
- 我如何改变默认对话框按钮的文本颜色在安卓5
- 更改单选按钮的圆圈颜色
- 如何在android中复制一个文件?
- adb找不到我的设备/手机(MacOS X)
- 如何在新的材质主题中改变背面箭头的颜色?
- androidviewpager与底部点
- 相同的导航抽屉在不同的活动
- 如何从视图中获得托管活动?
- 单一的TextView与多种颜色的文本
- 如何在非活动类(LocationManager)中使用getSystemService ?
- 在清单中注册应用程序类?
- Android:从数组中编程创建旋转器
- Android命令行工具sdkmanager总是显示:警告:无法创建设置