I am building an APP, and facing CLEARTEXT communication not permitted by network security policy error on my friend mobile (I am just testing it on anther mobile). of course i am not able to trace the problem as the application is working OK on my mobile (without USB debugging), I download it from google play.
I did all needed to resolve this problem by adding
android:usesCleartextTraffic="true"
to application tag in AndroidManifest.xml
also I added android:networkSecurityConfig="@xml/network_security_config"
my config XML:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">MY IP</domain>
</domain-config>
</network-security-config>
Its still not working. I cannot trace the problem on my mobile because its working. Why i am not getting the same error as my friend mobile???
I want it to give me same error on my mobile to be able to trace the problem. I removed all the above options and it still working on my mobile. It was even working before I added any thing as I only discovered the problem after Installed on my friend 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