ERR_CLEARTEXT_NOT_PERMITTED in debug app on Android

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

1 Like

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" />
    </edit-config>
4 Likes

yh, i got the same issue after adding it

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

10 Likes

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>

1 Like

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

<domain-config cleartextTrafficPermitted="true">

        <domain includeSubdomains="true">localhost</domain>
        <domain includeSubdomains="true">http://www.omdbapi.com</domain>
 <domain includeSubdomains="true">http://www.yourdomain.in</domain>
    <domain includeSubdomains="true">http://serveripaddress</domain>
    </domain-config>
4 Likes

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:
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
android:usesCleartextTraffic="true"
to
platforms/android/app/src/main/AndroidManifest.xml

<application android:hardwareAccelerated="true" 
android:icon="@mipmap/icon" 
android:label="@string/app_name" 
android:supportsRtl="true" 
`android:usesCleartextTraffic="true"`>

It looks that way.

13 Likes

this worked for me
thanks

It worked Magically.
Thanks.

i created account only for i say thanks, this worked for me

worked for me as well. Thanks.

Just Add

<base-config cleartextTrafficPermitted="true">
    <trust-anchors>
        <certificates src="system" />
    </trust-anchors>
</base-config>

to

resources/android/xml/network_security_config.xml

Like

<network-security-config>
<base-config cleartextTrafficPermitted="true">
    <trust-anchors>
        <certificates src="system" />
    </trust-anchors>
</base-config>

<domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true">localhost</domain>
</domain-config> </network-security-config>
21 Likes

@NurGuz
i hope this error comes because of android version 9
Try this…it worked for me

 <access origin="*" />
    <preferance name="android-usesCleartextTraffic" value="true" />
    <allow-navigation href="*" />
7 Likes