NativeScript Beginner's Guide
NativeScript is a cross-platform development framework, claiming performance is only 10% worse than native, while also supporting Angular syntax. For those with web and ng development experience, this is quite attractive.
Environment Setup
Node Installation
For Node installation, go directly to the official website click here
Suggestions:
- Install nvm to manage multiple Node versions on your machine
nvm install node
nvm use
- Install nrm, switch registry to Taobao to improve package installation speed
$ npm i -g nrm
$ nrm ls
$ nrm use taobao //switch registry to taobao
Install NativeScript CLI
npm install -g nativescript
Note: Global installation
iOS and Android Environment Installation
Different platforms, different strategies Follow the official documentation for specific installation details, no need to repeat here
Note:
- For Android environment, recommend first installing Android Studio, managing SDK through official IDE is more convenient
- If you’ve configured Android environment before, corresponding steps can be skipped
Verification Program
tns doctor
Create Project
tns create HelloWorld --template nativescript-template-ng-tutorial
Note:
Projects created via template lack App_Resources
resource folder content, so directly running below will report errors. Download from GitHub official demo click here, copy folder into project.
Run Project
tns run android
tns run ios
At this point, it should be basically OK. Next is to follow the official documentation in detail to learn basic concepts and usage.