Integrated Development Environment / Mobile App Development

Install NativeScript on Windows

September 5, 2016

Tags: , , , ,

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.

  1. Install NodeJS version 4.4.5 (current version at time of writing).
  2. Open a browser and navigate to http://docs.nativescript.org/angular/tutorial/ng-chapter-0
  3. 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.
  4. 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”.
  5. 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.
  6. Do this to turn off Hyper-V in Windows (this was a pain to figure out).
  7. 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.
  8. Step 7 only downloaded the HAXM file.  To actually run the .exe, navigate to the “extras” folder and double-click it.
  9. Restart the computer, enter the BIOS (usually F2, F12, or some combination.  Google for your motherboard preference) and ensure virtualization technology is enabled.
  10. Set up “Basic Nexus 4” via AVD Manager in C:\Program Files (x86)\Android\android-sdk.
  11. Download Visual Studio Code.
  12. Step through the NativeScript tutorial from Step 2.  The simulator should load the Nexus 4 you created in step 10.

Happy programming!

Author

James Trask

James is a 5-tool slo-pitch player, 12-cap golfer, and serviceable beer-league goaltender. He holds Bachelor's degrees in Computer Science and Business.

Your email address will not be published.