Android Studio / Win8 / ERR_NAME_NOT_RESOLVED

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24947363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:57:09  来源:igfitidea点击:

Android Studio / Win8 / ERR_NAME_NOT_RESOLVED

androidandroid-studiogoogle-tvandroid-tv

提问by znelson

Using Android Studio on Windows 8 x64 (latest stable build). I have an extremely simple project with nothing but a WebView pointed to google.com but everytime I launch the app in the emulator, I get ERR_NAME_NOT_RESOLVED.

在 Windows 8 x64(最新的稳定版本)上使用 Android Studio。我有一个非常简单的项目,只有一个指向 google.com 的 WebView,但是每次我在模拟器中启动应用程序时,我都会收到 ERR_NAME_NOT_RESOLVED。

I've made sure the INTERNET permission is in the manifest, I tried passing the -dns-server flag to the emulator pointing it to 127.0.0.1 as well as my router's IP, nothing works. I've scoured the web and found nothing, which seems suspicious. This is a relatively simple thing that I expected to work right out of the box.

我已确保清单中包含 INTERNET 权限,我尝试将 -dns-server 标志传递给模拟器,将其指向 127.0.0.1 以及我的路由器的 IP,但没有任何效果。我已经在网上搜索并没有发现任何东西,这似乎很可疑。这是一件相对简单的事情,我希望可以立即使用。

Any ideas? Thanks in advance!

有任何想法吗?提前致谢!

采纳答案by znelson

By disabling my NIC, I was able to get the emulator to use my Wifi connection. Answer found here: https://stackoverflow.com/a/2702663/568531

通过禁用我的 NIC,我能够让模拟器使用我的 Wifi 连接。答案在这里找到:https: //stackoverflow.com/a/2702663/568531

回答by user4577028

i have a solution, that isn't understandble for me, but it works: When the emulator has startet, i diconnect and connect my notebook wlan, and then it works.

我有一个解决方案,这对我来说是无法理解的,但它有效:当模拟器启动时,我断开并连接我的笔记本无线局域网,然后它就可以工作了。

回答by Pankaj Kumar Katiyar

Provided you've given access to internet in manifest.xml, and still emulator can't access internet, this solution worked for me on windows 7:

如果您已在 manifest.xml 中授予互联网访问权限,但模拟器仍无法访问互联网,则此解决方案在 Windows 7 上对我有用:

Click Start -->Run, type in cmd, press OK. Copy and paste this into the Command prompt: netsh winsock reset catalog Press Enter Then copy and paste this in: netsh int ip reset reset.log Press Enter. When finished restart your computer.

点击开始-->运行,输入cmd,点击确定。将其复制并粘贴到命令提示符中:netsh winsock reset catalog Press Enter 然后将其复制并粘贴到:netsh int ip reset reset.log 按 Enter。完成后重新启动计算机。

回答by Zvi

My solution was simply to restart the emulator. Sometimes it is not a real problem in the app but a problem of the emulator.

我的解决方案只是重新启动模拟器。有时它不是应用程序中的真正问题,而是模拟器的问题。

回答by Kris Roofe

I encounter this issue when I first run the simulator, I solved it by,

我第一次运行模拟器时遇到这个问题,我解决了,

Library/Android/sdk/platform-tools/adb shell getprop net.dns1

get the current dns server of simulator 10.0.2.3

获取模拟器当前的dns服务器 10.0.2.3

Then set it to my lan dns server

然后设置到我的局域网dns服务器

Library/Android/sdk/platform-tools/adb shell setprop net.dns1 192.168.1.1