The WebView running in the emulator in Android studio cannot access internet, but Chrome can?

匆匆过客 提交于 2019-12-22 09:13:25

问题


I installed Android studio 1.0.1 and followed this page https://developer.chrome.com/multidevice/webview/gettingstarted to wrap a website to an app.

However, I got the following error when running it in emulator.

Webpage not available

The webpage at https://..... could not be loaded because:

net::ERR_NAME_NOT_RESOLVED

However, I tried to click the link and it launched the website in Chrome without any problem.


回答1:


This may sound kind of obvious, but make sure 3G is turned on in your emulator:

To do so, turn on Cellular Data (on is the switch to the right):

Then notice the 3G symbol shows up above the signal strength symbol:

I've been trying to manage connection state and stumbled onto this question and know that's a possible reason for that error. It's a little late, but hopefully helps someone down the line.




回答2:


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:

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.



来源:https://stackoverflow.com/questions/27740296/the-webview-running-in-the-emulator-in-android-studio-cannot-access-internet-bu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!