Search code examples
androidcordovaionic-frameworkhybrid-mobile-app

to what was "ionic platform add android" command renamed to?


I am starting to learn Ionic, and on building my first application, when typing the

# ionic platform add android

it says that the command has been renamed. My question is, what was it changed with?

In the tutorial I follow, it says to execute the commands

# ionic platform add android
# ionic build android
# ionic run android

On searching the web, I have come across the command

# ionic cordova run android

and it also said that cordova was moved to a CLI which also has to be installed.

But what about "add" and "build"? They are not required anymore?

Thank you.


Solution

  • I believe you are using latest Ionic version, 3.6.0 and above. Since then Ionic cli commands have renamed from ionic platform add android to ionic cordova platform add android

    For all the commands append cordova after ionic keyword.

    For list of command, refer to the documentation here at https://ionicframework.com/docs/cli/

    Your tutorial commands are outdated. But you can still follow them, but just append cordova after ionic keyword

    ionic platform add android becomes ionic cordova platform add android

    ionic build android becomes ionic cordova build android

    ionic run android becomes ionic cordova run android

    "But what about "add" and "build"? They are not required anymore?" - You still need them for adding platforms/plugins.

    add is used for adding platforms/plugins. For ex: To add ios platform you use ionic cordova platform add ios

    build is used for Build (prepare + compile) an Ionic project for a given platform. For ex: To build ios you need ionic cordova build ios

    Note: you can replace ios with android or vise versa in any of the above commands.

    Since you started learning check this website out, might be a good place to start - https://ionicacademy.com/