The guide assumes the OS of your machine is High Sierra 10.13.3 for Mac users and Ubuntu 16.04 for Linux users. If a Linux distribution is used, please skip the iOS section and continue to the Android section.
Download and install the latest LTS NodeJS from the following link:
Note: At the time this guide was written, the latest LTS version of NodeJS was 8.10.0.
To install the global dependencies run:
$ npm install -g ionic cordova
Note: This command will install the latest version of Ionic and Cordova. At the time this guide was written, the latest version of Ionic was 3.20.0 and Cordova was 7.1.0.
SDK ENVIRONMENT FOR IOS AND ANDROID PLATFORMS
To be ready to add and build the iOS and Android platforms, follow the steps below.
The iOS platform can be added on MacOS only. If you do not use MacOS, please skip this step and continue to the Android section.
and install the latest Xcode version.
From your terminal, execute the following command to install the latest version of CocoaPods.
$ sudo gem install cocoapods
ENABLE COMMAND-LINE TOOLS
Once Xcode is installed, several command-line tools need to be enabled for Cordova to run. From your terminal, run:
$ xcode-select --install
INSTALL JAVA SE DEVELOPMENT KIT 8 (JDK)
Visit Oracle’s website and install Java SE Development Kit 8.
INSTALL ANDROID STUDIO 3.X
Visit Android’s Studio page and install Android Studio 3.x.
LINUX USERS ONLY
If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries. To determine what version of Linux is installed, open your terminal, type the following command at the prompt, and then hit Enter:
The “CPU op-mode(s)” entry tells you what version of Linux you’re running. If your running a 32-bit version of Linux you’ll see only a 32-bit mode listed and you can stop reading here. If you running a 64-bit version, you’ll see both the 32-bit and 64-bit modes listed since a 64-bit processor can run both. In that case you need to install the following 32-bit libraries. From your terminal, execute the command:
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
INSTALL SDK PLATFORMS
After installing the Android SDK, you must also install the packages for whatever API level you wish to target. To do it, open the Android Studio, and click on Configure -> SDK Manager.
Then, from the side menu, select Appearance & Behavior -> System Settings -> Android SDK click on the SDK Platforms tab and select one or more versions of APIs to download, as shown:
INSTALL ANDROID SUPPORT REPOSITORY
Usually, Android Support Repository is already configured once you install Android Studio. If it’s not, go to tools -> SDK Manager from the menu and on the SDK Tools tab select to install the Android Support Repository.
Sometimes, you may need to install gradle manually. To determine if Gradle is installed, open the Android Studio, and click on Configure -> Plugins.
Choose Enabled from Show and search for the Gradle plugin in the list.
If you can’t find the Gradle plugin you have to install it as directed at:
Note: Following the instructions of the aforementioned link, the latest Gradle distribution will be installed on your machine. At the time this guide was written, the installed Gradle version was 4.6.
For more information on the Android requirements, visit:
SET ENVIRONMENT VARIABLES
On a Mac, you can use a text editor to create or modify the
~/.profile file. To set an environment variable, add a line that uses export like so and substitute the path with your local installation:
On a Linux, you can use a text editor to create or modify the
~/.bashrc file. To set an environment variable, add a line that uses export like so and substitute the path with your local installation:
To install Sass open your terminal and execute the following command:
$ npm install -g sass