Ionic capacitor build can't request HTTP when build

Hi everyone,

I encounter something annoying, I have a small app i want to build on an Android Device.
Using this on browser (ionic serve) or livereload (ionic capacitor run android -l --external) it works fine but when i build directly with Gradle or generating an APK. This is not working at all.

var headersA = new HttpHeaders;
 headersA.append("Accept", 'application/json');
    headersA.append("Access-Control-Allow-Origin", "*")
    const httpOptions = {
      headers: headersA
this.http.put('', data, httpOptions).subscribe(d => () => { })

Adding these modifications didn’t work as well:


or creating a network_security_config.xml with

<?xml version="1.0" encoding="utf-8"?>
  <domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true"></domain>

Did someone encountered the same problem or is there any quick fix for that ?