title: Why is the error ERR_CLEARTEXT_NOT_PERMITTED with cleartext for the HTTP traffic persistent?
body: <p>I'm developing a new app using the Ionic-framework and I'm using the HttpClient module for API requests.</p>
  
  <p>The problem is that I've read and tried to apply the solutions on:</p>
  
  <ol>
  <li><a href="https://medium.com/@son.rommer/fix-cleartext-traffic-error-in-android-9-pie-2f4e9e2235e6" rel="noreferrer">https://medium.com/@son.rommer/fix-cleartext-traffic-error-in-android-9-pie-2f4e9e2235e6</a></li>
  <li><a href="https://forum.ionicframework.com/t/livereload-err-cleartext-not-permitted/163487" rel="noreferrer">https://forum.ionicframework.com/t/livereload-err-cleartext-not-permitted/163487</a></li>
  <li><a href="https://stackoverflow.com/questions/45940861/android-8-cleartext-http-traffic-not-permitted">Android 8: Cleartext HTTP traffic not permitted</a></li>
  <li><a href="https://stackoverflow.com/questions/54752716/why-am-i-seeing-neterr-cleartext-not-permitted-errors-after-upgrading-to-cordo">Why am I seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors after upgrading to Cordova Android 8?</a></li>
  <li><a href="https://stackoverflow.com/questions/55592392/how-to-fix-neterr-cleartext-not-permitted-in-flutter">How to fix &#39;net::ERR_CLEARTEXT_NOT_PERMITTED&#39; in flutter</a></li>
  <li><a href="https://stackoverflow.com/questions/53289679/android-pie-webview-showing-error-for-plain-http-on-some-sites-even-with-usesc">Android Pie: WebView showing error for plain HTTP on some sites, even with usesClearTextTraffic=&quot;true&quot;</a></li>
  <li><a href="https://stackoverflow.com/questions/52707918/webview-showing-err-cleartext-not-permitted-although-site-is-https?noredirect=1&amp;lq=1">WebView showing ERR_CLEARTEXT_NOT_PERMITTED although site is HTTPS</a></li>
  </ol>
  
  <p>But my app keeps throwing this error when it does a query to the API.</p>
  
  <p>Here are the details of my files:</p>
  
  <p>at <strong>/</strong>, the <strong>config.xml</strong> :</p>
  
  <pre><code>    &lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;widget id="com.example" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
      ...
      &lt;platform name="android"&gt;
          &lt;edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
              &lt;application android:networkSecurityConfig="@xml/network_security_config"/&gt;
              &lt;application android:usesCleartextTraffic="true" /&gt;
          &lt;/edit-config&gt;
          &lt;resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" /&gt;
       ...
  &lt;/widget&gt;
  </code></pre>
  
  <p>at <strong>/resources/android/xml/</strong>, the <strong>network_security_config.xml</strong> :</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;network-security-config&gt;
      &lt;domain-config cleartextTrafficPermitted="true"&gt;
        &lt;domain includeSubdomains="true"&gt;localhost&lt;/domain&gt;
      &lt;/domain-config&gt;
  &lt;/network-security-config&gt;
  </code></pre>
  
  <p>It is not valid to use the securely encrypted protocol HTTPS. The API only admits HTTP.</p>