JavaScript injection not working on Android Chromium WebView when target is Android 3.1
<p>My Android app injects JS code into a WebView. It is targeted Android 3.1 but I am experiencing issue with Android 6 and 7 because of the WebView now being chromium inside so it is not the old WebView. </p>

<p>Nevertheless the issue is very strange so I do not think it is because of the quirksmode my app forces to Android 6 and 7.</p>

<p>My app uses all the useful calls to load the JS interface that creates a binding between the Java code and the JS code, and it works on previous versions.
After those instructions (addJavascriptInterface() method) it performs a "fake" loading to ensure the JS interface is loaded:</p>

<pre><code>webView.loadData("", "text/html", null);
</code></pre>

<p>and when the "page" is loaded, it performs the loading of the real url, that is a local file (file:///...); when this is loaded too a script is injected and executed.</p>

<p>What I experience is that I get the following error on the log cat continuously:</p>

<pre><code>Cannot call determinedVisibility() - never saw a connection for the pid:
</code></pre>

<p>and I tried the various suggestions found on SO about this, but no success:</p>

<p>it's the "data:text/html" url that keeps being loaded again and again and I can stop it only loading an empty url but then the JS interface is lost.</p>

<p>What have I to do to keep the JS interface and block the infinite loading loop?</p>