If you're seeing that kind of error: ERR_CLEARTEXT_NOT_PERMITTED when trying to open a localhost url into Webview in Android then you need to allow that to be possible opening, here's how to do it:
You need to create that xml file into res/xml:
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config>
and after that in AndroidManifest.xml you need to add:
<application ... android:networkSecurityConfig="@xml/network_security_config"
It's done.
Top comments (0)