I commonly develop on Android & iOS at the same time, and I believe a lot of our users do as well. Before the 2.5 release I ran tns run android and tns run ios, and then ran tns livesync --watch to watch both platforms simultaneously.
Since 2.5 that workflow no longer really works. The livesync command is now marked as deprecated, and executing two separate tns run commands is problematic.
With that in mind we need to establish a recommended workflow for cross-platform simultaneous development. Let鈥檚 list ideas in this issue; I鈥檒l start with an idea I鈥檓 stealing from @bundyo.
What if we made tns run with no platform work. On macOS, tns run could build and deploy for iOS and Android, and watch each. On Windows and Linux tns run could build and deploy for just Android, and watch there as well.
Thoughts? Other ideas? Regardless of what we come up with I do think it鈥檚 important to have an established workflow for this common scenario for our next release.
related issue: https://github.com/NativeScript/nativescript-cli/issues/2445
My vote goes to running livesync/run for each platform. In other words always specifying the platform. Simply because it's less error prone.
I don't think tns run is error prone - we can detect the connected devices and emulators and build&deploy to them. I actually expected that to work, as it is the default behavior in Cordova CLI.
Cordova CLI is different and I don't think it's a good measure. We can make anything work, that's a fact. I prefer taking the safest rout and making the commands stable before anything else.
Just adding a vote for tns run. Right now if I start emulating iOS, and then start Genymotion to view the app on Android, the iOS emulator starts looping crazily and vice versa if I start on Android.
Looking forward to a resolution on this--I'm demoing NS 3.0.0-rc.1 to my dev team at work and was hoping to show simultaneous android & ios live reloading.
Hey @jlooper , @tjvantoll , @ejsuncy ,
In the last weeks we've worked on implementing this feature and we are now ready to ship it. You can try it now with CLI's next version while we are preparing official release, where it will be included.
The idea is to use $ tns run command and the command will work with all running devices and emulators. In case there's not running devices/emulators, the command will fail.
Please give it a try and inform us in case you have any questions or concerns.
@rosen-vladimirov Just tested this out and it works great!
Long term I wonder if we could come up with a way to also launch an emulator as part of this command. My typical use case is I want to deploy my app to an iOS simulator and Android emulator... but I have neither of those things open at the moment.
With this command I can now do tns run ios, Ctrl + C, tns run android, Ctrl + C, tns run, which does give me the exact workflow I want, but is a bit tedious. I suppose I could manually launch the simulators from Xcode and Android Studio, but I鈥檓 just so lazy.
Anyways, something to monitor to see if this is just me. For now tns run is an awesome feature and I can finally develop on Android & iOS simultaneously again. This is going to be great for gifs and demos 馃槃
Hey @tjvantoll ,
I'm glad the command is finally working for cross-platform development :1st_place_medal:
We were wondering the same thing - should we start emulator/simulator with tns run and if yes, when should we do it. Currently we've decided to make the command working with all available devices and to fail in case there aren't any available instances.
For example, in case you are working on macOS and you have attached Android device, should the tns run command start iOS Simulator?
Lets see what the community will think about the idea, maybe it is worth creating a separate issue for this.
Btw the latest official CLI release - 3.1.3 has the tns run command working as described here.
@rosen-vladimirov Agreed. I think it would be weird if tns run just launched emulators by default. I went ahead and created that separate issue to start the discussion: https://github.com/NativeScript/nativescript-cli/issues/3009.
I think this issue can be closed as simultaneous development is now totally possible 馃槃 We can discuss in #3009 if we can further improve the current workflow.
Thanks!
Most helpful comment
Just adding a vote for
tns run. Right now if I start emulating iOS, and then start Genymotion to view the app on Android, the iOS emulator starts looping crazily and vice versa if I start on Android.