Failed to execute ‘send’ on ‘XMLHttpRequest’: with a Java api

Thank you all for your help I managed to make it work, I found that the important thing is to use the tag below:

<plugin name="cordova-plugin-cleartext" source="npm" />

But I know that it’s not just him who needs it because I tried to put the config.xml with just her and it didn’t work.
Finally, the Config looked like this:

<?xml version="1.0" encoding="UTF-8"?>
<widget id = "com.nsbasic.app" version = "{version}"
xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:cdv="http://cordova.apache.org/ns/1.0">

<name>{title}</name>
<description>
{description}
</description>

<!-- Icons: Expand this section with sizes required for platforms you are targeting.
    Here is the list: http://wiki.phonegap.com/w/page/36905973/Icons%20and%20Splash%20Screens
-->
<icon src="{icon}" gap:role="default" width="57" height="57"/>
<preference name='SplashScreenDelay' value='2000' />
<preference name="AutoHideSplashScreen" value="true" />
<preference name='AndroidWindowSplashScreenAnimatedIcon' value='resources/splashTemplate.png' />
<preference name='AndroidWindowSplashScreenBackground' value='#000000' />
<plugin name='cordova-plugin-splashscreen' source='npm' />



<platforms>
  <platform name="android" >
    <preference name="AndroidXEnabled" value="true" />
    <preference name="AndroidPersistentFileLocation" value="Internal" />
    <preference name="android-minSdkVersion" value="22" />
    <preference name="android-targetSdkVersion" value="31" />
    <preference name="android-installLocation" value="auto" />
    <preference name="android-multiDexEnabled" value="true" />
    <preference name="Fullscreen" value="false" />
    <preference name="Orientation" value="portrait" />
    <preference name="android-signed" value="true" />
    <preference name="AndroidLaunchMode" value="singleTop" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-intent href="market:*" />
    <access origin="*" />
    <icon platform="android" src="package-assets/ic_ldpi.png" density="ldpi" width="36" height="36" />
    <icon platform="android" src="package-assets/ic_mdpi.png" density="mdpi" width="48" height="48" />
    <icon platform="android" src="package-assets/ic_hdpi.png" density="hdpi" width="72" height="72" />
    <icon platform="android" src="package-assets/ic_xhdpi.png" density="xhdpi" width="96" height="96" />
   </platform> 
</platforms>

<preference name="hostname" value="localhost" />
<preference name="AndroidInsecureFileModeEnabled" value="true" />

<!-- gap:plugin name="cordova-plugin-whitelist" source="npm" /> -->
<allow-navigation href="*" />
<access origin="*" />
<allow-intent href="*" />


<plugin name="cordova-plugin-statusbar" source="npm" />
  <preference name="StatusBarBackgroundColor" value="{phoneGapStatusBarColor}" />
  <preference name="StatusBarStyle" value="{phoneGapStatusBarStyle}" />


<plugin name="cordova-plugin-btprinter" source="npm" />

<plugin name="cordova-plugin-cleartext" source="npm" />

<plugin name="cordova-plugin-device" source="npm" />

<plugin name="cordova-plugin-androidx-adapter" source="npm" />




<!-- sample feature specification -->
<!-- <feature name="http://api.phonegap.com/1.0/network"/> -->

<!-- sample preference specification -->
<!-- <preference name="autorotate" value="false" readonly="true"/> -->
</widget>

I’ll try to find out exactly what you need in the config.xml and pass it on here.