Livereload ERR_CLEARTEXT_NOT_PERMITTED

Use the below command to livereload, it will work
ionic cordova run android --device -l --ssl --debug

5 Likes

Same Problem help me on this

Maybe you can try some of these things:

  1. Check your config.xml
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
            <application android:networkSecurityConfig="@xml/network_security_config" />
            <application android:usesCleartextTraffic="true" />
        </edit-config>
        <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
        <allow-navigation href="*" />
  1. You enter all domains, localhost, webservices / api, upload url, etc at resources/android/xml/network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain>localhost</domain>
        <domain>api.example.id</domain>
        <domain>www.youtube.com</domain>
    </domain-config>
</network-security-config>
  1. You can clean and reload the Android Platform & AndroidManifest.xml

cordova clean android

4 Likes

same problem any solutions ??

this work <domain>PORT_MY_APP_RUNNING_ON</domain>
(i.e. <domain>123.456.7.890</domain> )

I’m unable to add
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge"
on config.xml, because at every build that line is removed (I don’t know why)

2 Likes

It’ll work fine if you add the config to network_security_config.xml in the resources/android/xml folder.

change it like,

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
    	<domain includeSubdomains="true">localhost</domain>
    	<domain includeSubdomains="true">Your server ip or domain address</domain>
    </domain-config>
</network-security-config>

remember not to include http:// and port number in it.

For Eg: if your server is running at http://123.456.789.00:8080, then the config should be,

<domain includeSubdomains="true">123.456.789.00</domain>

7 Likes

this works for me! thanks. my env: ionic 5.2.3

I am also put this but i build the application added lines are removed.

This is my problem in ionic 4. Help me to solve this error. Link is below

Link

Work’s for me thanks dude.

I’m also unable to add the <edit-config> options to config.xml, but this solution worked!

This helped, thanks mate!

Worked for me. Thanks!

Just Replace this:

<application android:networkSecurityConfig="@xml/network_security_config" />

and Add this:

<application android:usesCleartextTraffic="true" />

Example:

<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>

I hope to solve your problem.

Where is the config.xml ?

i just run this command :

ionic cordova run android -l --ssl

Add this line in config,xml for android, then remove platform and add it again then try

It should work

Adding domain tag worked for me :+1:

This one did the job for me.