ERR_CLEARTEXT_NOT_PERMITTED in debug app on Android

I’m still working on getting my movie database application working and I found out how to remotely view the error messages on the app in Chrome, so now I see as I type and the server is called, I get the following error message:


It appears that this should be able to be solved by putting a line in the Android Manifest file, which I should be able to do by adding the following line to the config.xml


Which I did (see below)

        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="">
            <application android:networkSecurityConfig="@xml/network_security_config" />
            <application android:usesCleartextTraffic="true" />

I’m still getting the error message however, even after re-deploying and reconnecting the debugging.

Anyone have any experience on how to solve this issue on Android?

1 Like

[SOLUTION] On top of your config.xml file add this code:

    <access origin="*" />
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:usesCleartextTraffic="true" />
    <allow-navigation href="*" />

It works for me.


It gives me this error: :app:mergeDebugResources. Anyone got the same problem?

Hi @pabloo87 !

In that case, I suggest you to do as follows:
ionic cordova platform remove cordova

After this do that:
ionic cordova platform add cordova@7

And try again:
ionic cordova run android --livereload

Please, let me know if it helps you!

That seems to totally screw things up.

Unable to load PlatfromApi from platform. Error [Err_UNHANDLED_ERROR]" Unhandled error. (Does not appear to implement platform Api.)
Unhandled error. (The platform “cordova” does not appear to be a valid cordova platform. It is missing API.js. cordova not supported.)

And now I can re-install it.

Oh joy.

Thanks for the suggestion but i solved the problem in a different way.

Can you tell me how you solved the problem?

Yes, i modified network_security_config.xml file changing <domain>localhost</domain> to <domain>served_ip</domain>, after the last ionic update the served ip it’s “localhost” so there is no need to change the file anymore. I recommend you to update the app

The purpose is just to let you to reinstall the Cordova version 7.

Doesn’t work for me, any idea?

Use the below command to livereload
ionic cordova run android --device -l --ssl --debug

1 Like

I had updated IONIC CLI (v5) and Android platforms-tools to v28.

ionic cordova run android -l

After, you need update your config.xml

 <access origin="*" />
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:usesCleartextTraffic="true" />

yh, i got the same issue after adding it

Adding <allow-navigation href="*" /> in my config.xml solves the issue


I had the same error “Err-cleartext-not-permitted-in” coming in debug console.
I resolved it by adding IP address of the API url in
network_security_config.xml file changing <domain>localhost</domain>

goto project/resources/android/xml/network_security_config.xml

<domain-config cleartextTrafficPermitted="true">

        <domain includeSubdomains="true">localhost</domain>
        <domain includeSubdomains="true"></domain>
 <domain includeSubdomains="true"></domain>
    <domain includeSubdomains="true">http://serveripaddress</domain>

For me this worked! Apparently this issue comes on the latest phones.

this answer solve my problem, many thanks!

i have this enviroment btw

Ionic CLI : 5.2.3
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.2

Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4

that’s how I solved the problem.

I add this line

<application android:hardwareAccelerated="true" 

It looks that way.


this worked for me