1

After updating ionic and cli. I suddenly started facing net::ERR_CLEARTEXT_NOT_PERMITTED whenever calling a Rest API on actual android device.

1 Answer 1

1

I solved this by

adding

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
    <application android:usesCleartextTraffic="true" />
</edit-config>

to config.xml.

Then add

<access origin="*" /> <allow-navigation href="*" />

to /resources/android/xml/network_security_config.xml

 <?xml version="1.0" encoding="utf-8"?>
 <network-security-config>
   <domain-config cleartextTrafficPermitted="true">
     <domain includeSubdomains="true">yourdomain.com</domain>
  </domain-config>
</network-security-config>

to config.xml in the widget inside the <platform> for android.

Then

ionic cordova platform rm android

and

ionic cordova platform add [email protected]

Not the answer you're looking for? Browse other questions tagged or ask your own question.