Ionic cordova build succeeds but ionic cordova run fails for android

Hi Team

I am trying to generate a debug apk which I can install on my device but with build release android I am getting unsigned apk. So I searched and ran

ionic cordova run android 

The build fails with this exception

Execution failed for task ':CordovaLib:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

I am using windows 10 64 bit and here is the package.son info

java version “1.8.0_131”

“dependencies”: {
"@angular/common": “4.1.3”,
"@angular/compiler": “4.1.3”,
"@angular/compiler-cli": “4.1.3”,
"@angular/core": “4.1.3”,
"@angular/forms": “4.1.3”,
"@angular/http": “4.1.3”,
"@angular/platform-browser": “4.1.3”,
"@angular/platform-browser-dynamic": “4.1.3”,
"@ionic-native/core": “3.12.1”,
"@ionic-native/splash-screen": “3.12.1”,
"@ionic-native/status-bar": “3.12.1”,
"@ionic/storage": “2.0.1”,
“chart.js”: “^2.7.1”,
“cordova-plugin-console”: “^1.0.5”,
“cordova-plugin-device”: “^1.1.4”,
“cordova-plugin-splashscreen”: “^4.0.3”,
“cordova-plugin-statusbar”: “^2.2.2”,
“cordova-plugin-whitelist”: “^1.3.1”,
“ionic-angular”: “3.6.0”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“rxjs”: “5.4.0”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.12”,
“cordova-android”: “~6.3.0”
},
“devDependencies”: {
"@ionic/app-scripts": “2.1.3”,
“ionic”: “3.18.0”,
“typescript”: “2.3.4”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“ionic-plugin-keyboard”: {},
“cordova-plugin-whitelist”: {},
“cordova-plugin-console”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {}
},
“platforms”: [
“android”
]
}
}

target api 23 and min 14
can some direct me to what is going wrong here , since its working with build but failing for run android

Try to remove platform android and add again then try to build

tried to remove and again add the platform , and also downgraded the target api to 25, installed

android sdk 25

got these errors

> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 26].

in manifest.xml i have set target level 25 still getting errors for android sdk 26 , how is this possible , during build ionic should look for version 25 right ?

also I have the licenses folder and have the licenses file placed there

any suggestions

Hi while u running SDK manager ,Run it with Administrator Privileges .

Try with Run as Administrator.

Post your ionic info output please.
Post your ionic cordova requirements output.

Thank you for your reponse I got it running

This is what worked for me hope it helps some1else

Deleted licenses folder from c:/Android/sdk

Then went to c:/Android/sdk/tools/bin
Launched terminal in this directory

Sdkmanager --update

This resolved license error

In config.xml located in the root folder of your project
Added preference to target api level to 25 and the magic build succeeded and installed it on my device

Changing androidmanifest.xml didnt work for me

@Moh497 am getting config.xml error…please help me sort error :> ionic cordova build android

cp: copyFileSync: could not write to dest file (code=ENOENT):G:\ion\cam\platforms\android\res\xml\config.xml

Parsing G:\ion\cam\platforms\android\res\xml\config.xml failed
(node:5396) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open ‘G:\ion\cam\platforms\android\res\xml\config.xml’
(node:5396) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[18:35:11] lint finished in 6.63 s