I know that a similar question was raised under Why am I seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors after upgrading to Cordova Android 8? but unfortunately non of the answers fixed my problem.
- Ionic Framework : @ionic/angular 5.8.4
- @angular-devkit/build-angular : 0.901.13
- Cordova CLI : 10.0.0 (cordova-lib@10.1.0)
- Cordova Platforms : android 9.0.0, browser 6.0.0
- Android Studio 2020.3.1
After deleting the platforms folder of my ionic project, I wanted to emulate my project again by running:
sudo ./Android/Sdk/emulator/emulator -avd Pixel_3a_API_28
cordova prepare android
ionic cordova emulate android -l 
And all of a sudden I always get the error message that there is a network problem. That has never happened before to me, so I tried to add the configs from the link above. Here is my resources/android/xml/network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<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>
and part of my config.xml (and I tried all versions from the link above!):
    <platform name="android">
        <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" />
        </edit-config>
        <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>
        <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
I installed new virtual device using Android Studio, but same error.

 
    