我浪费了一整天的时间尝试在 SO 和其他提到的地方浮动的不同解决方案,以在 android 模拟器上启用 wifi,但无济于事.谁能帮我弄清楚如何在我的安卓模拟器上启用互联网?
I have wasted a whole day trying out different solutions floating around in SO and other place mentioned to enable wifi on the android emulator but to no avail. Can anybody help me figure out how do I enable internet on my android emulator?
我有 Nexus 5X API 27,目标是 Android 8.1 (Google Play)和 Nexus 5 API P,目标是 Android 7.1.1.
I have Nexus 5X API 27 and target being Android 8.1 (Google Play) and Nexus 5 API P and target being Android 7.1.1.
我相信应该有一种方法可以在其上启用互联网,否则在模拟器上提供虚拟 wifi 的全部意义似乎都是浪费.
I believe there should be a way to enable internet on it or else the whole point of providing virtual wifi on the emulator seems to be waste.
我在 mac OS HS 10.13.4 上直接连接到我的路由器,没有代理.
I am on mac OS HS 10.13.4 directly connected to my router with no proxy.
我什至尝试删除所有 AVD,然后重新安装它们.我什至尝试使用 Oreo Android 8.1 安装最新的 Pixel 2
I even tried deleting all the AVDs, re-installing them. I even tried having installed the latest Pixel 2 with Oreo Android 8.1
似乎没有任何效果.有没有人遇到过这个问题并找到了解决方案?
Nothing seems to be working. Has anybody faced this issue and found a solution?
任何帮助都会有很大帮助
Any help would be of great help
谢谢,维克拉姆
更新:当我通过手机连接我的电脑作为热点wifi时,模拟器通过wifi上网,但是当我将我的电脑连接到我的家庭路由器时它失败了.
Update: When I connect my computer through my phone as hotspot wifi, the emulator has internet through wifi, but it fails when I connect my computer to my home router.
以下是适用于 Windows 和 Mac 的解决方案,但类似的解决方案适用于任何操作系统:
Stated below are the solutions for Windows and Mac, but similar solutions will work on any OS:
在 Windows 上
将首选和备用 DNS 服务器设置为(下面的屏幕截图):
Set the Preferred and Alternate DNS servers as (Screenshot below) :
8.8.8.8
8.8.4.4
在 Mac 上
删除您那里的所有条目并添加这两个条目(下面的屏幕截图):
Delete whatever entries you have there and add these two entries (Screenshot below):
8.8.8.8
8.8.4.4
注意:对于 Mac 用户,如果条目字段被禁用并且您无法对其进行编辑,请单击该窗口底部区域的锁定"图标并输入密码以能够做出改变
重启模拟器,应该可以解决:
Restart the emulator, and it should solve:
截图:
这是针对模拟器的 wifi 已将 DNS 更改为某些非工作 DNS 的情况的修复.虽然这在大多数情况下都有效,但可能还有其他情况此解决方案可能无法解决的原因.
This is the fix for a situation when the emulator's wifi has changed the DNS to some non-working DNS. While this works most of the time, there might also be other reasons which may not fix from this solution.
这篇关于Android Studio - 没有互联网连接的 Android 模拟器 Wifi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!