Fix Cleartext Traffic Error in WebView

Jyotishgher Astrology
By -
4
                                      Fix Cleartext Traffic Error in WebView

Recently I got error in my App JYOTISHGHER:

java.io.IOException: Cleartext HTTP traffic to * not permitted

What I did:


When an app communicates with servers using a cleartext network traffic, such as HTTP, it could raise a risk of eavesdropping and tampering of content. Third parties can inject unauthorized data or leak information about the users. That is why developers are encouraged to a secure traffic only, such as HTTPS.


INSERT THIS LINE INTO MANIFEST:

METHOD 1

<application
    android:usesCleartextTraffic="true"
METHOD 2
android:networkSecurityConfig="@xml/network_security_config"
@xml/network_security_config
  1. Add a network security config file under res/xml.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">your_domain.com</domain>
    </domain-config>
</network-security-config>

ENJOY TO ALL:

Post a Comment

4Comments

Post a Comment