Povolit cleartext na Android

Chyba "Failed to load resource: net::ERR_CLEARTEXT_NOT_PERMITTED" na Android 9 a vyšší:

Upravit resources/android/xml/network_security_config.xml :

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

Lepší způsob:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">localhost</domain>
        <domain includeSubdomains="true">dev.pretty.cz</domain>
        <domain includeSubdomains="true">api.pretty.cz</domain>
    </domain-config>
</network-security-config>
Není-li uvedeno jinak, obsah této stránky je pod licencí Creative Commons Attribution-ShareAlike 3.0 License