What does cordova prepare and then run vs cordova platform add and then run?

Solution 1:

Adding a platform in Cordova does not run the prepare command which will run hook scripts.

  1. Assuming the android platform is not already added, this will generate the directory platforms/android and populate it with a complete standalone Android project. Cordova plugins that have been installed will also be installed into the Android project. cordova run android will run cordova prepare android followed by cordova build android, then proceed to install and run the application. If the android platform is already added Cordova will throw and error.
  2. This command is redundant, and, assuming the android platform has already been added, will run cordova prepare android twice followed by cordova build android, then install and run that application. If the platform is not added Cordova will throw an error.

Conclusion

It makes little sense to differentiate between the two command sequences you provided as they seldom need to be executed. You usually only add a platform once, and you can just call cordova run android without needing to call cordova prepare android before it unless you intend to use cordova build android manually (potentially as a signed release) followed by using adb or saving/deploying the generated APK without needing to do a full blown run.