API 29 webview net::ERR_CLEARTEXT_NOT_PERMITTED

903 Views Asked by At

In my webview I load an html, which is a string, as follows:

myWebView.loadData(htmlTemplate, "text/html", "utf-8");

This displays a certain content, where there is a button. In the click of the button, a url is supposed to be loaded:

http://10.5.6.13:9090/

But it fails with error net::ERR_CLEARTEXT_NOT_PERMITTED

I have already tried all the popular suggested answers that suggest to add:

android:usesCleartextTraffic="true"

or override networkSecurityConfig:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">10.5.6.13</domain>
    </domain-config>
</network-security-config>

This is the list of the already tried answers:

https://stackoverflow.com/a/52708032/12202026

https://stackoverflow.com/a/53387018/12202026

http://android--kotlin.blogspot.com/2019/03/android-webview-neterrcleartextnotpermi.html

And many popular other answers out there, but still nothing.

0

There are 0 best solutions below