[SOLVED] Is there a cmd to build both android and ios at the same time?


It take around 3min to build my app (exactly 166.28s) before the cordova platform packaging part, therefore I would be happy to be able sometimes, specially when I’m testing before releasing, to build both iOS and Android one after the other on the same src. So, is there any cmd to do that?

I mean instead of

 ionic cordova build iOS --prod => Ionic build + cordova packaging = output iOS
 ionic cordova build android --prod => Ionic build + cordova packaging = output Android

something like

ionic cordova build ****** --prod =>  Ionic build + cordova iOS packaging + cordova Android packaging = output iOS and Android


Combination of commands

npm run build && cordova build android && cordova build ios

should work. First one builds /src to /www, following build /www to the platform directories.

(You can probably replace the cordova commands with an ionic cordova command with a --no-build flag - or seomthing similar - but I can’t find it right now. If not: This should maybe be added.)


Gonna try, thx for the tips!


If you want to use that more often, have a look at the scripts part of package.json, which you can run via npm run ....


Sorry for the delay…just tried…actually “npm run build” doesn’t work in my project

npm ERR! missing script: build

Anyway look like there is no straight answer, maybe that could be a feature for the ionic-cli?

Something like maybe be handy:

ionic cordova build all --prod --release


That’s strange. Try npm run ionic:build then. (Look at package.json scripts element for the definition of these - where you could also add the combined execution of things as our own command)

The ionic cordova commands are only proxies for cordova commands. Cordova doesn’t really offer that, so it would not be very wise to offer that in Ionic CLI (without adding additional maintenance overhead).


You are right for both point, the cmd and your remark on the cli, thx!

The cmd would then look like (I didn’t find the --no-build option for ionic neither):

npm run ionic:build --prod && cordova build android --release  && cordova build ios

Just tried it and it solved my question, thx for your help :thumbsup:

P.S.: I mark this post as the solution, since it contains the cmd, but it was fully provided by @Sujan12 :slight_smile:


Psst, there is an issue now: https://github.com/ionic-team/ionic-cli/issues/2420