Android dev builds on API 28/29 show ERR_CLEARTEXT_NOT_PERMITTED

Seems like a solved problem for cordova. Any way to handle for capacitor?

Are you using Capacitor or Cordova? You posted in the capacitor category, yet you’re running cordova commands.

If you are using cordova add a config tag in your config.xml. Something along the lines of

<edit-config target="AndroidManifest.xml" parent="/manifest">
    <application  android:usesCleartextTraffic="true" mode="merge">
</edit-config>

If you’re using Capacitor then a) don’t run cordova commands in it and b) Capacitor shouldn’t be overwriting any Android files in the first place.

I am getting same error in capacitor. Please help

Just add this to your AndroidManifest.xml in the tag like

<application android:usesCleartextTraffic="true">

it Worked perfectly. Thanks for reply.

After adding android:usesCleartextTraffic=true, i am getting connection refused error, any idea?

are you serving from localhost from a framework?

you need to specify your computers ip in the url field in capacitor.config.json instead od localhost

1 Like

Even I’m getting the same ! Somebody please help !!

You need to add the IP address in network configuration file found at resources/XML folder. Because by default http requests are not allowed as of now

I did. Still getting the same error. Would be really great if you could help !

Hi, can you please elaborate? I’m at the noob level here. The thing is I don’t find any network config file under the XML folder.

resources/android/xml here you need to write

<?xml version="1.0" encoding="utf-8"?> localhost IP ADDRESS

In config.xml







The solution for connection refused error is, while running with live reload add your ip address with address flag.
Command: “ionic capacitor run android -l --address=YOUR_IP_ADDRESS”

If running on a device, make sure your device and your dev machine is connected to the same network.