Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve Source path does not exist: resources/android/xml/network_security_config.xml

Tags:

I do build with ionic 4.

ionic cordova build android

Got this error

cordova build android

Source path does not exist: resources/android/xml/network_security_config.xml [ERROR] An error occurred while running subprocess cordova.

I removed this part from config.xml. Is it fine?

    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">         <application android:networkSecurityConfig="@xml/network_security_config" />     </edit-config>     <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" /> 

package.json

    {       "name": "morenito",       "version": "0.0.1",       "author": "Ionic Framework",       "homepage": "https://ionicframework.com/",       "scripts": {         "ng": "ng",         "start": "ng serve",         "build": "ng build",         "test": "ng test",         "lint": "ng lint",         "e2e": "ng e2e"       },       "private": true,       "dependencies": {         "@angular/animations": "~8.0.1",         "@angular/cdk": "8.0.1",         "@angular/material": "8.0.1",         "@angular/common": "~8.1.2",         "@angular/compiler": "~8.1.2",         "@angular/core": "~8.1.2",         "@angular/forms": "~8.1.2",         "@angular/http": "^7.2.2",         "@angular/platform-browser": "~8.1.2",         "@angular/platform-browser-dynamic": "~8.1.2",         "@angular/router": "~8.1.2",         "@ionic-native/base64": "^5.5.1",         "@ionic-native/base64-to-gallery": "^5.6.0",         "@ionic-native/camera": "^5.10.0",         "@ionic-native/camera-preview": "^5.4.0",         "@ionic-native/core": "^5.0.0",         "@ionic-native/file": "^5.4.0",         "@ionic-native/file-chooser": "^5.4.0",         "@ionic-native/file-path": "^5.5.1",         "@ionic-native/file-transfer": "^5.5.1",         "@ionic-native/image-picker": "^5.5.1",         "@ionic-native/splash-screen": "^5.0.0",         "@ionic-native/status-bar": "^5.0.0",         "@ionic/angular": "^4.7.1",         "browser": "^0.2.6",         "cordova-android": "^8.0.0",         "cordova-plugin-camera": "^4.1.0",         "cordova-plugin-ionic-webview": "^4.1.1",         "cordova-plugin-telerik-imagepicker": "^2.3.3",         "core-js": "^2.5.4",         "hammerjs": "^2.0.8",         "highcharts": "^7.1.1",         "highcharts-angular": "^2.4.0",         "highcharts-more": "^0.1.7",         "highcharts-more-node": "^5.0.13",         "moment": "^2.24.0",         "ng2-charts": "^2.0.3",         "rxjs": "~6.5.1",         "tslib": "^1.9.0",         "zone.js": "~0.9.1"       },       "devDependencies": {         "@angular-devkit/architect": "~0.801.2",         "@angular-devkit/build-angular": "~0.801.2",         "@angular-devkit/core": "~8.1.2",         "@angular-devkit/schematics": "~8.1.2",         "@angular/cli": "~8.1.2",         "@angular/compiler": "~8.1.2",         "@angular/compiler-cli": "~8.1.2",         "@angular/language-service": "~8.1.2",         "@ionic/angular-toolkit": "~2.0.0",         "@types/jasmine": "~3.3.8",         "@types/jasminewd2": "~2.0.3",         "@types/node": "~8.9.4",         "codelyzer": "^5.0.0",         "cordova-plugin-device": "^2.0.2",         "cordova-plugin-ionic-keyboard": "^2.1.3",         "cordova-plugin-splashscreen": "^5.0.2",         "cordova-plugin-statusbar": "^2.4.2",         "cordova-plugin-whitelist": "^1.3.3",         "jasmine-core": "~3.4.0",         "jasmine-spec-reporter": "~4.2.1",         "karma": "~4.1.0",         "karma-chrome-launcher": "~2.2.0",         "karma-coverage-istanbul-reporter": "~2.0.1",         "karma-jasmine": "~2.0.1",         "karma-jasmine-html-reporter": "^1.4.0",         "protractor": "~5.4.0",         "ts-node": "~7.0.0",         "tslint": "~5.15.0",         "typescript": "~3.4.3"       }  ,   "description": "An Ionic project",   "cordova": {     "plugins": {       "cordova-plugin-whitelist": {},       "cordova-plugin-statusbar": {},       "cordova-plugin-device": {},       "cordova-plugin-splashscreen": {},       "cordova-plugin-ionic-webview": {         "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"       },       "cordova-plugin-ionic-keyboard": {},       "cordova-plugin-telerik-imagepicker": {},       "cordova-plugin-camera": {         "ANDROID_SUPPORT_V4_VERSION": "27.+"       }     },     "platforms": [       "android"     ]   } } 

FOR VALIDATOR ONLY: Is it a stackoverflow or an art competition? Hello validator - you bother me day by day. This post contains enough of text.

like image 475
Mike Kylmä Lampi Avatar asked Aug 08 '19 23:08

Mike Kylmä Lampi


2 Answers

Examine the resources folder if the xml folder exists in /android, if it doesn't just create it like..

resources/     android/         xml/            network_security_config.xml 

Enter the following inside the file

<?xml version="1.0" encoding="utf-8"?> <network-security-config>   <domain-config cleartextTrafficPermitted="true">     <domain includeSubdomains="true">localhost</domain>   </domain-config> </network-security-config> 
like image 197
Mr Strange Avatar answered Nov 09 '22 02:11

Mr Strange


I also got that error check this

https://github.com/ionic-team/starters/issues/758

in android platform in ionic

<platform name="android">  <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">     <application android:networkSecurityConfig="@xml/network_security_config" /> </edit-config> <resource-file src="resources/android/xml/network_security_config.xml" target="res/xml/network_security_config.xml" /> <allow-intent href="market:*" /> 
like image 21
Chanaka Weerasinghe Avatar answered Nov 09 '22 01:11

Chanaka Weerasinghe