简体   繁体   中英

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. However, when connecting to my website I receive an error, net::ERR_NAME_NOT_RESOLVED. Changed the loadUrl with a popular website like Google.com and it worked just fine.

My website works fine from Google Chrome, on dekstop, etc.. just not in WebView.. Can anyone help explain why?

On Another note , I am also trying to find a way to manually enter the dns settings, hoping this would resolve the matter. 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?

@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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM