CLEARTEXT communication not permitted by network security policy working on my mobile CLEARTEXT communication not permitted by network security policy working on my mobile android android

CLEARTEXT communication not permitted by network security policy working on my mobile


If you use Http instead of Https in your api url, then just add this line in AndroidManifest.xml in <application> tag.

android:usesCleartextTraffic="true"

It will solve your problem


I had the same problem with react-native project. I get resolved the issue with this article, putting the domain name of my hosting provider.

  • Create res/xml/network_security_config.xml with content:
<?xml version="1.0" encoding="utf-8"?><network-security-config>    <domain-config cleartextTrafficPermitted="true">        <domain includeSubdomains="true">my-domain-name.com</domain>    </domain-config></network-security-config>
  • Point to this file from your manifest (for bonus points add it only for the test manifest):
<application  android:networkSecurityConfig="@xml/network_security_config"  android:label="@string/app_name"  android:theme="@style/AppTheme">     <activity android:name=" (...)</application>