You are currently viewing CLEARTEXT communication not supported (Solved)

Are you also facing the issue CLEARTEXT communication not supported in Android? This problem occurs because in Android 9 (API level 28), cleartext support is disabled by default. You have to create the XML folder and then create the network_security_config.xml file in it. Let us see how can we do that.

Create file res/xml/network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">Your URL(ex: 127.0.0.1)</domain>
    </domain-config>
</network-security-config>

Open AndroidManifest.xml and put the code as shown below

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:usesCleartextTraffic="true"
        android:name=".MyApplication"
        android:allowBackup="true"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        ...>
        ...
    </application>
</manifest>

That is it, you are all set. Hope this article had helped you resolve the issue.

That’s it Folks on this topic. Let us know your comments on this article in the comment box below. Kindly like our facebook page, follows us on twitter and subscribe to our YouTube channel for latest updates.

Leave a Reply