简体   繁体   English

Android WebView,错误 net::Name_Not_Resolved

[英]Android WebView, err net::Name_Not_Resolved

I have tried searching through the docs and other forums but no success.我试过搜索文档和其他论坛,但没有成功。

I have an android application that is simply a webView that opens up a website as soon as you open the app.我有一个 android 应用程序,它只是一个 webView,只要您打开应用程序,它就会打开一个网站。 However, when connecting to my website I receive an error, net::ERR_NAME_NOT_RESOLVED.但是,当连接到我的网站时,我收到一个错误net::ERR_NAME_NOT_RESOLVED。 Changed the loadUrl with a popular website like Google.com and it worked just fine.使用 Google.com 等热门网站更改了 loadUrl,效果很好。

My website works fine from Google Chrome, on dekstop, etc.. just not in WebView.. Can anyone help explain why?我的网站在谷歌浏览器、桌面等上运行良好。只是不在 WebView 中。谁能帮忙解释一下原因?

On Another note , I am also trying to find a way to manually enter the dns settings, hoping this would resolve the matter.另一方面,我也在尝试找到一种手动输入 dns 设置的方法,希望这能解决问题。 Any tips or pointing me down the right path is very much appreciated.非常感谢任何提示或指出我正确的道路。

Thanks.谢谢。

Did you set WebViewClient and get error net::ERR_NAME_NOT_RESOLVED from this method?您是否设置了 WebViewClient 并从此方法中获取错误 net::ERR_NAME_NOT_RESOLVED ?

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
      super.onReceivedError(view, request, error);
      Log.d(TAG, error.getDescription());
}

if yes, I've resolved this using this method如果是,我已经使用这种方法解决了这个问题

@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
     super.onReceivedError(view, errorCode, description, failingUrl);
     Log.d(TAG, description);
}

the first method, I got an error even though the website fully loaded, my suspect is the first method too sensitive so if the website fails to load javascript or CSS or something, the first method returns the error too.第一种方法,即使网站完全加载,我也收到错误,我怀疑是第一种方法过于敏感,所以如果网站无法加载 javascript 或 CSS 或其他东西,第一种方法也会返回错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 flutter webview net::ERR_NAME_NOT_RESOLVED - flutter webview net::ERR_NAME_NOT_RESOLVED Android Webview ERR_NAME_NOT_RESOLVED 加载 URL - Android Webview ERR_NAME_NOT_RESOLVED loading an URL Cordova Android 无法加载资源:.net::ERR_NAME_NOT_RESOLVED - Cordova Android Failed to load resource: net::ERR_NAME_NOT_RESOLVED 安卓模拟器浏览器中的ERR_NAME_NOT_RESOLVED - ERR_NAME_NOT_RESOLVED in browser of android emulator Android Studio Webview-加载后不显示任何连接消息,而不显示在Android App中,而不显示ERR_NAME_NOT_RESOLVED - Android Studio Webview - Show no connection message instead of in Android App after it has loaded, instead of ERR_NAME_NOT_RESOLVED 从 android 应用程序“net::ERR_NAME_NOT_RESOLVED”运行 tor.so - Run tor.so from android app "net::ERR_NAME_NOT_RESOLVED" 通过 html 脚本标签获取源代码会在某些 Android 设备上导致 net::ERR_NAME_NOT_RESOLVED - get source via html script tag causes net::ERR_NAME_NOT_RESOLVED on some Android devices 我的用户得到“net::err_name_not_resolved” - My users get "net::err_name_not_resolved" Android Studio / Win8 / ERR_NAME_NOT_RESOLVED - Android Studio / Win8 / ERR_NAME_NOT_RESOLVED Android Webview中的loadUrl()因net :: ERR_CACHE_MISS而失败 - loadUrl() in Android Webview fails with net::ERR_CACHE_MISS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM