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
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
- 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:
Thank u
ReplyDeleteyoure amazing its perfect works
ReplyDeletein android N - both failed to resolved that problem.
ReplyDeleteSorry Android P and Q
Delete