title: Android webview loading fail in API 21 and above
body: <p>I have an Android application that uses WebView and load a page. This application works on <strong>Android devices running API 16 or above</strong>.</p>
  
  <p>Android WebView Code:</p>
  
  <pre><code>String URL = "https://sandbox.napas.com.vn/gateway/message";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_web_view);
  
      webview = (WebView) findViewById(R.id.webview);
  
      webview.getSettings().setJavaScriptEnabled(true);
      webview.getSettings().setAllowFileAccess(true);
      webview.getSettings().setPluginState(PluginState.ON);
      webview.getSettings().setDomStorageEnabled(true);
      webview.getSettings().setAllowContentAccess(true);
      webview.getSettings().setAllowFileAccessFromFileURLs(true);
      webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
  
      webview.setWebChromeClient(new MyWebChromeClient());
      webview.loadUrl(URL);
  
      webview.setWebViewClient(new WebViewClient() {
  
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
  
              view.loadUrl(url);
              return true;
          }
  
          @Override
          public void onPageStarted(WebView view, String url, Bitmap favicon) {
              super.onPageStarted(view, url, favicon);
          }
  
          @Override
          public void onPageFinished(WebView view, String url) {
              super.onPageFinished(view, url);
          }
      });
  }
  </code></pre>
  
  <p>But webview load page empty and have logs:</p>
  
  <pre><code>E/libEGL(25467): validate_display:255 error 3008 (EGL_BAD_DISPLAY)
  W/AudioCapabilities(25467): Unsupported mime audio/evrc
  W/AudioCapabilities(25467): Unsupported mime audio/qcelp
  W/VideoCapabilities(25467): Unrecognized profile 2130706433 for video/avc
  W/AudioCapabilities(25467): Unsupported mime audio/amr-wb-plus
  W/AudioCapabilities(25467): Unsupported mime audio/mpeg-L1
  W/AudioCapabilities(25467): Unsupported mime audio/mpeg-L2
  D/ConnectivityManager(25467): CallingUid : 10063, CallingPid : 25467
  D/ConnectivityManager.CallbackHandler(25467): CM callback handler got msg 524290
  W/AudioCapabilities(25467): Unsupported mime audio/x-ms-wma
  W/AudioCapabilities(25467): Unsupported mime audio/x-ima
  W/AudioCapabilities(25467): Unsupported mime audio/qcelp
  W/AudioCapabilities(25467): Unsupported mime audio/evrc
  W/VideoCapabilities(25467): Unsupported mime video/wvc1
  W/VideoCapabilities(25467): Unsupported mime video/x-ms-wmv
  W/VideoCapabilities(25467): Unrecognized profile/level 32768/2 for video/mp4v-es
  W/VideoCapabilities(25467): Unsupported mime video/wvc1
  W/VideoCapabilities(25467): Unsupported mime video/x-ms-wmv
  W/VideoCapabilities(25467): Unsupported mime video/x-ms-wmv7
  W/VideoCapabilities(25467): Unsupported mime video/x-ms-wmv8
  W/VideoCapabilities(25467): Unsupported mime video/mp43
  W/VideoCapabilities(25467): Unsupported mime video/sorenson
  W/VideoCapabilities(25467): Unsupported mime video/mp4v-esdp
  </code></pre>
  
  <p>Please help me fix this error. Thanks</p>