問題描述
我浪費了一整天的時間嘗試在 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 上
- 打開網絡和共享中心并點擊當前連接
- 點擊屬性
- 雙擊Internet 協議版本 4 (TCP/IPv4)
將首選和備用 DNS 服務器設置為(下面的屏幕截圖):
- Open Network and Sharing Center and click on current Connection
- Click on Properties
- Double Click on Internet Protocol Version 4 (TCP/IPv4)
Set the Preferred and Alternate DNS servers as (Screenshot below) :
8.8.8.8
8.8.4.4
在 Mac 上
- 轉到設置 > 網絡 > 高級...> DNS
刪除您那里的所有條目并添加這兩個條目(下面的屏幕截圖):
- Go to Settings > Network > Advanced... > DNS
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:
截圖:
- Windows
- 蘋果機
這是針對模擬器的 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模板網!