Cleartext HTTP traffic not permitted (Android Studio)

Cleartext HTTP traffic not permitted

Cleartext HTTP traffic not permitted :

 Following solution allow you to set the protocol (HTTP / HTTPS) per ENVIRONMENT.

This way you are able to use http for your DEV-Environment, and https for your PRODUCTION-Environment, without the need to change it all the time! And this is needed, because generally you don't have an https-certificate for your local or dev environment, but it's a MUST-HAVE for production (and maybe for staging) environments.

But you can add additional directories to overwrite your AndroidManifest.xml. Here is how it works:
  • Create the Directory /app/src/debug
  • Inside create the AndroidManifest.xml
AndroidManifest.xml
 android:usesCleartextTraffic="true"
 
Here an Example how it looks like for the requested CLEARTEXT-Permission:
package="com.yourappname">  
   <application  
       android:usesCleartextTraffic="true"  
       android:name=".MainApplication"  
       android:label="@string/app_name"  
       android:icon="@mipmap/ic_launcher"  
       android:allowBackup="false"  
       android:theme="@style/AppTheme">  
   </application>  
 </manifest>
If You don't know how to work this, Please watch my video. 
If any problem please comments below. i will try to help you. thank you

More Article

  1. How to use firebase in webview android studio
  2. Android Navigation Drawer
  3. WebView with stylish Progress Bar
Next Post Previous Post
No Comment
Add Comment
comment url