NativeScript example, step by step, Windows 10

A tiny, 5 minute, tutorial on creating a new empty project using NativeScript + TypeScript, compiling it and running in Android.

First of all, install NativeScript (NodeJS v4.6.0 x64)plus the latest NativeScript. Check if the installation is OK:

tns doctor

Create the new project with TypeScript support, inside your projects folder:

tns create DemoApp --ng

Add target platforms:

cd DemoApp
tns platform add ios
tns platform add android

(the ios one only works if you have a mac…)

Edit the package.json (change package name, etc.)

Test the empty app (android example). The example below is for using your USB connected device or a non emulator VM (such as Genymotion). If you want to use the android SDK emulator just add ” –emulator” at the end.

tns run android

This will download dependencies, compile everything, and push the APK to your device.

While in development, if you don’t want to recompile every time, run:

tns livesync android --watch

again, with ” –emulator” at the end if necessary. This will listen for any code changes and push them to your device without recompiling everything.





Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from try {} except

Subscribe now to keep reading and get access to the full archive.

Continue reading