简体   繁体   English

设备上的nativescript livereload

[英]nativescript livereload on device

i am using https://github.com/NathanWalker/angular2-seed-advanced which creates a running nativescript app. 我正在使用https://github.com/NathanWalker/angular2-seed-advanced创建运行的本机脚本应用程序。

now, i am a starter with nativescript and wanted to ask, how i can achieve a good development flow. 现在,我是使用nativescript的初学者,想问一下我如何才能实现良好的开发流程。

i am coming from ionic where i was able to see the console output on my development machine and was able to test my app live on a cable connected device. 我来自Ionic,我能够在开发机上看到控制台输出,并能够在连接电缆的设备上实时测试我的应用程序。 live reloading was running also. 实时重装也在运行。

so my questions: 所以我的问题是:

  1. can i run my app on a device without publishing it to the store 我可以在不将其发布到商店的情况下在设备上运行我的应用程序吗
  2. will i be able to see the console.log output somehow on my local dev machine with adb or a nativescript cli command? 我可以使用adb或nativescript cli命令在本地开发机器上以某种方式看到console.log输出吗?
  3. is live reloading possible for developing nativescript apps? 开发本地脚本应用程序是否可以实时重新加载?

Thank you in advance! 先感谢您!

  1. yes
  2. yes
  3. yes

    tns livesync android --watch tns livesync android --watch

  1. You can install the app to your own Android / iOS real devices and/or the iOS simulator and Android emulators, all without sending it to any of the stores. 您可以将应用程序安装到自己的Android / iOS真实设备和/或iOS模拟器和Android模拟器上,而无需将其发送到任何商店。

  2. You can see the log fine, typically when you do a tns run [ios|android] the log is pipped back to your console. 您可以看到正常的日志,通常当您执行tns run [ios | android]时 ,日志便被放回控制台。 You can also run the standard adb logcat (android) or idevicesyslog (for iOS if installed) 您还可以运行标准adb logcat (android)或idevicesyslog (对于iOS,如果已安装)

  3. Live reloading is possible, and works fairly well. 实时重新加载是可能的,并且效果很好。 You can use the tns run [android|ios] which is built into the tns command line. 您可以使用tns命令行中内置的tns run [android | ios]

The answer to all three questions is yes (as another answer point out). 这三个问题的答案都是肯定的(另一个答案指出)。 To add to answer of question 3, As of nativescript version 2.5.0, tns run and tns livesync does the same thing, tns run has the ability to apply changes and sync it to a running app on device/emulator. 为了回答问题3,从nativescript 2.5.0版本开始, tns runtns livesync都做同样的事情, tns run具有应用更改并将其同步到设备/模拟器上正在运行的应用程序的能力。 The message on console clearly says tns livesync is being deprecated, so you should always look to use tns run 控制台上的消息清楚地表明tns livesync已被弃用,因此您应该始终使用tns run

在此处输入图片说明

Here are the latest options(As of 2018-Jan) to run the app in live sync mode with a device when you are using NathanWalker -angular-seed-advanced. 这是最新的选项(截至2018年1月),当您使用NathanWalker -angular-seed-advanced时,可以在设备上以实时同步模式运行该应用程序。

iOS (device):   npm run start.ios.device --debug
Android (device):  npm run start.android.device --debug

--debug option will pull in more logs from the device(not just for your app, but also other activities) --debug选项将从设备中获取更多日志(不仅针对您的应用,还包括其他活动)

Check the latest doc here for up-to date commands, 此处查看最新文档以获取最新命令,

You can also use adb as explained here , 您还可以按照此处的说明使用adb,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM