0

I am creating my web app using phonegap and it works fine but I come to know that it is not working in android 9 pie, it shows web page not found with the below message

net::ERR CLEARTEXT_NOT_PERMITTED

I tried to rectify it by adding the below code in my network-security-config.xml file

<?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
        <base-config cleartextTrafficPermitted="true">
            <trust-anchors>
                <certificates src="system" />
            </trust-anchors>
        </base-config>
    </network-security-config>

And also added the below lines in AndroidManifest.xml

<manifest... >
    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:usesCleartextTraffic="true">
    </application>
</manifest>

But I do not get it right. Can anyone help me with the solution ? Thanks in advance.

Ajay Mehta
  • 843
  • 5
  • 14
Javith J
  • 77
  • 2
  • 9
  • https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted – AskNilesh Apr 29 '19 at 05:57
  • @Nilesh Rathod I worked on the solutions in https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted , but I didn't get it right – Javith J Apr 29 '19 at 06:53

1 Answers1

0

This simple code works for me:

network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

And in AndroidManifest file:

android:networkSecurityConfig="@xml/network_security_config">