title: Nativescript gradle build fails with "resource xml/network_security_config not found"
body: <p>I have an existing Nativescript angular app that I have been able to run on my Android emulator without any problems. The other day I updated the tns-android version from 4.1.3 to 5.0.0 using the following command:</p>
  
  <pre><code>tns platform update android
  </code></pre>
  
  <p>I then tried running the emulator again using the following command</p>
  
  <pre><code>tns run android --bundle
  </code></pre>
  
  <p>However, I haven't been able to get the app working since the update because of the following error:</p>
  
  <pre><code>error: resource xml/network_security_config (aka org.nativescript.app:xml/network_security_config) not found.
  </code></pre>
  
  <p>My AndroidManifest.xml looks like this:</p>
  
  <pre><code>&lt;application
     android:name=...
     android:debuggable="true"
     android:networkSecurityConfig="@xml/network_security_config"&gt;
     ...
  &lt;/application&gt;
  </code></pre>
  
  <p>I have a network_security_config.xml file located in /App_Resouces/Android/xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;network-security-config&gt;
     &lt;debug-overrides&gt;
        &lt;trust-anchors&gt;
           &lt;certificates src="system" /&gt;
           &lt;certificates src="user" /&gt;
        &lt;/trust-anchors&gt;
     &lt;/debug-overrides&gt;
  &lt;/network-security-config&gt;
  </code></pre>
  
  <p>I tried removing the platform and adding it again but the same error occurred. I also tried removing the platform and installing a specific version of the android platform but still no luck.</p>
  
  <p>When I checked my git history I can see the only tracked file that changed in the repo was the package.json file. I tried reverting back to the last commit that I know worked but still I saw the same error.</p>
  
  <p><strong>Previously</strong></p>
  
  <pre><code>"tns-android": {
    "version": "4.1.3"
  } 
  </code></pre>
  
  <p><strong>After Update</strong></p>
  
  <pre><code>"tns-android": {
    "version": "5.0.0"
  } 
  </code></pre>
  
  <p>The only way I can get my build to work is if I remove <strong>android:networkSecurityConfig="@xml/network_security_config"</strong> from the AndroidManifest.xml. However, I need this for development purposes as I am using a localhost endpoint and Android needs to use <a href="https://10.0.2.2" rel="noreferrer">https://10.0.2.2</a>. See the following article <a href="https://medium.com/@noumaan/ssl-app-dev-a2923d5113c6" rel="noreferrer">https://medium.com/@noumaan/ssl-app-dev-a2923d5113c6</a></p>
  
  <p>I'm pretty sure at this point that during the platform update some file was modified outside of the repo that is causing this issue. I tried creating a new nativescript-angular project and then adding network_security_config to the AndroidManifest but the error still happens on a brand new project</p>
  
  <pre><code>tns create HelloWorld --template tns-template-blank-ng
  </code></pre>
  
  <p>The full log file from running the tns build command can be seen below:</p>
  
  <pre><code>Gradle build...
           + setting applicationId
           + applying user-defined configuration from /&lt;path&gt;/nativescript-app/app/App_Resources/Android/app.gradle
  Using support library version 28.0.0
           + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
           + adding aar plugin dependency: /&lt;path&gt;/nativescript-app/node_modules/tns-core-modules-widgets/platforms/android/widgets-release.aar
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:processDebugResources'.
  &gt; Android resource linking failed
    Output:  /&lt;path&gt;/nativescript-app/platforms/a
  ndroid/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/An
  droidManifest.xml:22: error: resource xml/network_security_config (aka org.nativescr
  ipt.app:xml/network_security_config) not found.
    error: failed processing manifest.
  
    Command: /&lt;path&gt;/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-osx.jar/ea8e83f954287505ed9d825341b12875/aapt2-3.2.0-4818971-osx/aapt2 link -I\
            /&lt;path&gt;/Library/Android/sdk/platforms/android-28/android.jar\
            --manifest\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
            -o\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
            -R\
            @/&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
            --auto-add-overlay\
            --java\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
            --custom-package\
            org.nativescript.app\
            -0\
            apk\
            --no-version-vectors\
            --output-text-symbols\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/symbols/debug/R.txt\
            --no-version-vectors
    Daemon:  AAPT2 aapt2-3.2.0-4818971-osx Daemon #0
    Output:  /&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml:22: AAPT: error: resource xml/network_security_config (aka org.nativescript.app:xml/network_security_config) not found.
  
    error: failed processing manifest.
    Command: /&lt;path&gt;/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-osx.jar/ea8e83f954287505ed9d825341b12875/aapt2-3.2.0-4818971-osx/aapt2 link -I\
            /&lt;path&gt;/Library/Android/sdk/platforms/android-28/android.jar\
            --manifest\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
            -o\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
            -R\
            @/&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
            --auto-add-overlay\
            --java\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
            --custom-package\
            org.nativescript.app\
            -0\
            apk\
            --no-version-vectors\
            --output-text-symbols\
            /&lt;path&gt;/nativescript-app/platforms/android/app/build/intermediates/symbols/debug/R.txt\
            --no-version-vectors
    Daemon:  AAPT2 aapt2-3.2.0-4818971-osx Daemon #0
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 3s
  Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed
   with exit code 1.
  Executing after-watch hook from /&lt;path&gt;/natives
  cript-app/hooks/after-watch/nativescript-dev-typescript.js
  Executing after-watch hook from /&lt;path&gt;/natives
  cript-app/hooks/after-watch/nativescript-dev-webpack.js
  Stopping webpack watch
  Executing after-watch hook from /&lt;path&gt;/natives
  cript-app/hooks/after-watch/nativescript-dev-typescript.js
  Executing after-watch hook from /&lt;path&gt;/nativescript-app/hooks/after-watch/nativescript-dev-webpack.js
  </code></pre>