Unable to generate apk

Hi there,
I’m new to this forum, yet hoping that this forum helps me out.
I have this project in ionic and I’m very new to this. I figured out almost everything and was able to generate apk and sign it.
but for another app related to the project, I’m able to “ionic serve”, however with " ionic cordova build --release android",
I’m getting following error:

:\Users\HP\Desktop\1 Harbonn Ap1p\App_code\User_app\platforms\android\app\src\main\res\xml\network_security_config.xml:9: Error: Missing includeSubdomains attribute [NetworkSecurityConfig]
        <domain>localhost</domain>
         ~~~~~~

   Explanation for issues of type "NetworkSecurityConfig":
   Ensures that a <network-security-config> file, which is pointed to by an
   android:networkSecurityConfig attribute in the manifest file, is valid

   https://developer.android.com/preview/features/security-config.html

[I had put my hosting ip address within this as I did for my previous app within this file]

Error 2: Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForRelease’.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompat$CallbackHandler

As a beginner, I’m not able to understand these two errors. Any help would be appreciated.
Here are some things that you may need:

  • I’ve ionic cordova sdk and gradle successfully installed and added necessary environement variables for these. All latest version.

Please help me here considering my knowledge with npm commands as beginners.
Thank you!