Issue
I checked the documentation but didn't find a clear explanation about when to use those commands:
cordova platform add android && cordova run androidcordova prepare android && cordova run android
In the documentations the run command does this:
Run project (including prepare && compile)
run is already running prepare. So, is there any case where I need the option 2? To me it looks like it doesn't make sense if I'm using run after that.
Thank you in advance for your valuable time : )
Solution
Adding a platform in Cordova does not run the prepare command which will run hook scripts.
- Assuming the android platform is not already added, this will generate the directory
platforms/androidand populate it with a complete standalone Android project. Cordova plugins that have been installed will also be installed into the Android project.cordova run androidwill runcordova prepare androidfollowed bycordova build android, then proceed to install and run the application. If the android platform is already added Cordova will throw and error. - This command is redundant, and, assuming the android platform has already been added, will run
cordova prepare androidtwice followed bycordova 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.
Answered By - NoodleOfDeath
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.