TECHIES WORLD

For Techs.... Techniques.... Technologies....

Linux

Android app Error: net::ERR_CLEARTEXT_NOT_PERMITTED

net::ERR_CLEARTEXT_NOT_PERMITTED

This is an error message got on Android ionic application while calling external apis without ssl.

Android applications allows only https (ssl enabled) apis by default. So if the application tries to hit apis without ssl, it will throw this error.

We can fix this error by adding the following lined to the file "config.xml" within the ionic application root folder.

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

Nos the application should be able to work with apis without ssl too.

Please note that this solution is not recommended for production environment as its reducing the security of data transfer. So for production environment, the best practice is to enable ssl of apis and use https urls in application.

That's all…

Leave a Reply