WebView is not loading page in Android 9.0?

后端 未结 7 1636
时光说笑
时光说笑 2020-12-03 05:24
 public abstract class MainActivity extends AppCompatActivity {

        private static WebView web;
        private WebView mWebView;
        private java.lang.Stri         


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 06:11

    Actually you should avoid using http, but if there is no way you can do this:

    1. Add @xml/network_security_config into your resources:

      
      
          
              www.smedk.ru
          
      
      
    2. Add this security config to your Manifest like this:

      
      
          ...
      
      
    3. Now you allowed using HTTP connection on www.smedk.ru subdomains.

    You can read more in https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted

    Note: The guidance in this section applies only to apps that target Android 8.1 (API level 27) or lower. Starting with Android 9 (API level 28), cleartext support is disabled by default.

提交回复
热议问题