Home Email My Account ☎ 480-624-2500

ERR_CLEARTEXT_NOT_PERMITTED

January 2, 2021

Product: Android Studio

Issue: Error returned while running Android Studio emulator using WebView

Error: ERR_CLEARTEXT_NOT_PERMITTED

Cause: Cleartext is any transmitted or stored information that is not encrypted or meant to be encrypted.

Resolution: 

Option 1. Use a secure URL (https://) for the website you are trying to load

Option 2. Add android:usesCleartextTraffic="true" to the application manifest between the applicaiton node.

Option 3. Add a network security config file under res/xml.

a. Add res/xml/network_security_config.xml

b. Add a domain config and set cleartextTrafficPermitted to “true”.

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

c. Add your network security config to your Android manifest file under application.

<application
    android:name=".MyApplication"
    android:networkSecurityConfig="@xml/network_security_config"
...