CLEARTEXT communication to ip not permitted by network security policy in Android Pie (SDK 28)

Known:

Mobile Device android sdk 21 (Lolypop) and sdk 28 (Pie)

Used Third Party : retrofit 2

Problem:

When i press KAMERA button: it was upload an image to server then error “CLEARTEXT communication to 192.168.43.142 not permitted by network security policy” appear like image below:

Question:

How to fix this … ?

Answer:

Just add this attribute to application tag in AndroidManifest.xml file:

 android:usesCleartextTraffic="true"

So the application tag look like this one:

 <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        android:theme="@style/AppTheme">

Thanks for reading

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *