Table of Contents
IONIC Error: Unknown argument: platform
Unknown argument: platform
D:\sync\websvr\ionic\test\t2>ionic cordova run android
[INFO] Hardware device(s) found for android. Using --device.
> ng.cmd run app:ionic-cordova-build --platform=android
Error: Unknown argument: platform
[ERROR] An error occurred while running subprocess ng.
ng.cmd run app:ionic-cordova-build --platform=android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
ionic info
D:\sync\websvr\ionic\test\t2>ionic info
Ionic:
Ionic CLI : 6.20.4 (E:\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 6.4.0
@angular-devkit/build-angular : 15.0.3
@angular-devkit/schematics : 15.0.3
@angular/cli : 15.0.3
@ionic/angular-toolkit : 7.0.0
Cordova:
Cordova CLI : 11.0.0
Cordova Platforms : android 10.1.2
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 3 other plugins)
Utility:
cordova-res : 0.15.4
native-run : 1.7.1
System:
NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
npm : 8.1.0
OS : Windows 10
Fix IONIC Error: Unknown argument: platform
npm install @ionic/cordova-builders
Copy this to angular.json
"ionic-cordova-build": {
"builder": "@ionic/cordova-builders:cordova-build",
"options": {
"browserTarget": "app:build"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
}
}
},
"ionic-cordova-serve": {
"builder": "@ionic/cordova-builders:cordova-serve",
"options": {
"cordovaBuildTarget": "app:ionic-cordova-build",
"devServerTarget": "app:serve"
},
"configurations": {
"production": {
"cordovaBuildTarget": "app:ionic-cordova-build:production",
"devServerTarget": "app:serve:production"
}
}
}
Then you can run
ionic cordova run android --target=emulator-5554