After android9.0, WebView can’t load the link starting with HTTP, or an error is reported.
Solution:
1. Add android:usesCleartextTraffic = true in the Application tag of AndroidManifest;
2. Set in webclient
webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
if (url.startsWith("http://") || url.startsWith("https://")) {
webView.loadUrl(url)
return true
}
return true
}
}
Read More:
- Error inflating class in WebView in Android 5. X android.webkit.WebView Solutions
- WebView load webpage, HTTP call error
- Android error reporting: error inflating class android.webkit.WebView
- The local web page in WebView failed to load with XMLHttpRequest
- Bitmap, cache and fresco Android image loading Library
- Android API 27 and above use HTTP protocol request mode
- IOS WebView failed to load the web page. Error domain = kcferrodomaincfnetwork code = 310 “there was a problem communicating with the secure web proxy server (HTTPS). “
- WebView loadrequest request request error “nsurlconnection finished with error – Code – 1022”
- Error: Error parsing D:\new_android\Android SDK\system-images\android-25\android-wear\armeabi-v7a\de
- Android Studio | Failed to find target with hash string ‘android-26’ in: D:\Android\sdk
- python: HTTP Error 505: HTTP Version Not Supported
- Error parsing HTTP request header Note: further occurrences of HTTP header p
- An Ajax HTTP error occurred in drupal7 installation occurred.HTTP Result Code
- Android: Web access activity error: error unknown URL scheme
- urlopen error unknown url type:httpë/HTTP Error 400:Bad Request
- Springboot project: error parsing HTTP request header note: further occurrences of HTTP request parsing
- How to use Android android:supportsRtl attribute
- Android Studio Error: Invoke-customs are only supported starting with Android O (–min-api 26)
- How to Fix com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
- Android 9.0 APP Install Android 4.4 Error: classnotfoundexception