title: Android WebView Not allowed to load local resource
body: <p>I am trying to display an image from a local image file in a webview using html.</p>
  
  <p>But fore some reason the image is not loading, and I get the following message:</p>
  
  <pre><code>I/chromium: [INFO:CONSOLE(0)] "Not allowed to load local resource: file://data/user/0/{package_name_here}/files/images/382d26c2-5ff1-4082-93ab-2e34baa4ecbb.png"
  </code></pre>
  
  <p>I am 100% sure that I have granted the runtime permissions and the permsissions for webview.</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
  wv.getSettings().setJavaScriptEnabled(true);
  
      // Enable plugins
      wv.getSettings().setPluginState(WebSettings.PluginState.ON);
  
      // Increase the priority of the rendering thread to high
      wv.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
  
      // Enable application caching
      wv.getSettings().setAppCacheEnabled(true);
  
      // Enable HTML5 local storage and make it persistent
      wv.getSettings().setDomStorageEnabled(true);
      wv.getSettings().setDatabaseEnabled(true);
  
      wv.getSettings().setAllowFileAccess(true);
      wv.getSettings().setAllowFileAccessFromFileURLs(true);
      wv.getSettings().setAllowContentAccess(true);
      wv.getSettings().setAllowUniversalAccessFromFileURLs(true);
  </code></pre>
  
  <p>The html text looks like this:</p>
  
  <pre><code> private String html = "&lt;!DOCTYPE html&gt;\n" +
          "&lt;html&gt;\n" +
          "    &lt;head&gt;\n" +
          "        \n" +
          "    &lt;/head&gt;\n" +
          "    &lt;body&gt;\n" +
          "    \t&lt;div &gt;\n" +
          "\t\t    \n" +
          "\t\t    &lt;div&gt;&lt;img src=\"file://data/user/0/package_name_here/files/images/382d26c2-5ff1-4082-93ab-2e34baa4ecbb.png\"/&gt;&lt;/div&gt;\n" +
          "\t\t&lt;/div&gt;\n" +
          "    &lt;/body&gt;\n" +
          "&lt;/html&gt;";
  </code></pre>
  
  <p>I am loading the html like this:</p>
  
  <pre><code>mBinding.webView.loadData(html, "text/html", "UTF-8");
  </code></pre>