The bulk of our mobile development over the last couple years has been in Ionic/Cordova. We decided to branch out and scope some of the other hybrid technologies available to developers. The first technology we looked at was NativeScript. Getting the basic install up and running proved to be difficult, and the basic guides assume you’re installing on a clean machine…which if you’re a developer, is rarely the case.
The following guide will help you install NativeScript and build and run the sample app from the NativeScript website. This guide is particularly of interest if you’re a developer with multiple IDEs (we use Visual Studio, primarily) which require a host of tools and environment variables configured.
- Install NodeJS version 4.4.5 (current version at time of writing).
- Open a browser and navigate to http://docs.nativescript.org/angular/tutorial/ng-chapter-0
- In a command prompt (run as administrator), type “npm install –g nativescript”. This will start the install process for NativeScript and install it globally for all users.
- At the end of the install, it will likely say you’re missing some things and ask if you want to “run the script”. Say “yes” to run the script. This “script” goes through all the dependencies and asks if you want to install them. Say “yes”.
- Open your Environment Variables (right-click My Computer –> Properties –> Advanced System Settings –> Environment Variables). Make sure ANDROID_HOME and JAVA_HOME are set. In particular, make sure JAVA_HOME is set to the latest (1.8.x) JDK environment.
- Do this to turn off Hyper-V in Windows (this was a pain to figure out).
- Open the Android SDK manager (as administrator) in C:\Program Files (x86)\Android\android-sdk. Under “Other” at the bottom, “install” HAXM for x86 virtual processors.
- Step 7 only downloaded the HAXM file. To actually run the .exe, navigate to the “extras” folder and double-click it.
- Restart the computer, enter the BIOS (usually F2, F12, or some combination. Google for your motherboard preference) and ensure virtualization technology is enabled.
- Set up “Basic Nexus 4” via AVD Manager in C:\Program Files (x86)\Android\android-sdk.
- Download Visual Studio Code.
- Step through the NativeScript tutorial from Step 2. The simulator should load the Nexus 4 you created in step 10.