Hi All,
My ionic serve works fine but when i try to add android platform then it is showing bellow error:
Adding android project…
Using this version of Cordova with older version of cordova-android is deprecated. Upgrade to cordova-android@5.0.0 or newer.
Error: Your android platform does not have Api.js
Below is the output with --verbose option:
Task: title=platform, name=platform, summary=Add platform target for building an Ionic app, =, [options]=, title=Do not add default Ionic icons and splash screen resources, boolean=true, title=Do not save the platform to the package.json file, boolean=true, isProjectTask=true, run=function run(ionic, argv, rawCliArguments) {
var appDirectory = process.cwd();
var cmdName = process.argv[2].toLowerCase();
var rawArgs = rawCliArguments.slice(0);
var argumentName = argv._[2];
var isAddCmd = argv..indexOf(‘add’) !== -1;
var isRmCmd = argv..indexOf(‘rm’) !== -1 || argv._.indexOf(‘remove’) !== -1;
var addResources = isAddCmd && !(argv.noresources || argv.r);
// ensure the content node was set back to its original
return ConfigXml.setConfigXml(appDirectory, {
resetContent: true,
errorWhenNotFound: false
})
.then(function() {
if (addResources) {
return IonicResources.copyIconFilesIntoResources(appDirectory)
.then(function() {
return IonicResources.addIonicIcons(appDirectory, argumentName);
});
}
})
.then(function() {
var optionList = cordovaUtils.filterArgumentsForCordova(cmdName, argv, rawArgs);
return cordovaUtils.execCordovaCommand(optionList);
})
.then(function(runCode) {
// We dont want to do anything if the cordova command failed
if (runCode !== 0 || argv.nosave) {
return;
}
if (isAddCmd) {
log.info('Saving platform to package.json file');
return State.savePlatform(appDirectory, argumentName);
}
if (isRmCmd) {
log.info('Removing platform from package.json file');
return State.removePlatform(appDirectory, argumentName);
}
})
.catch(function(ex) {
if (ex instanceof Error) {
log.error(ex);
}
});
}
Looking up Ionic root, cwd: /Users/ankitkau/Ankit Kaushik/ionic/mapskool-latest
Ionic root directory: /Users/ankitkau/Ankit Kaushik/ionic/mapskool-latest
Package.json found scripts: ionic:build=ionic-app-scripts build, ionic:serve=ionic-app-scripts serve
Npm scripts: ionic:build=ionic-app-scripts build, ionic:serve=ionic-app-scripts serve
Gulpfile found: false
ConfigXml.setConfigXml /Users/ankitkau/Ankit Kaushik/ionic/mapskool-latest resetContent=true, errorWhenNotFound=false
Executing cordova cli: platform add android --verbose
No scripts found for hook “before_platform_add”.
saving
Running command: npm install “/Users/ankitkau/Ankit Kaushik/ionic/mapskool-latest/android” --save
Command finished with error code 0: npm install,/Users/ankitkau/Ankit Kaushik/ionic/mapskool-latest/android,–save
Adding android project…
Using this version of Cordova with older version of cordova-android is deprecated. Upgrade to cordova-android@5.0.0 or newer.
Error: Your android platform does not have Api.js