Installation and Setup of Android & IOS using Ionic3 Cordova

Ramesh Prajapati
4 min readJun 5, 2018

--

​Ionic apps are created and developed primarily through the Ionic command line utility (the “CLI”), and use Cordova to build/deploy as a native app. This means we need to install a few utilities to get developing.

Install Node & NPM

Cordova runs on Node.JS platform, so first we need to install LST version of Node and NPM

The quickest way to get Node and NPM installed on your machine is through the NodeJS installer

Close any terminals/command prompts you may have open, run the installer, and launch a new Node terminal window.

To verify you have everything installed correctly, you can run

npm — version and

node –version

If version number is displayed means node and npm installed correctly.

Install Cordova

With Node and NPM setup, let’s install the Ionic and Cordova CLI.

Open Node.js terminal or Command Prompt(cmd) and run below command.

npm install -g cordova

Note: The -g means this is a global install

Install Ionic

Ionic comes with a convenient command line utility to start, build, and package Ionic apps.

To install it, simply run:

npm install -g ionic

Requirements for Android Device

Install Java JDK

Before moving to ahead, make sure Java JDK and JRE are installed in your system.

Open a command prompt (cmd) and run following command:

javac — version

if you see the version number, you have already installed JDK & JRE.

If you do not have the JDK installed, proceed as follows:

Download the Java SE JDK (SE = Standard Edition) from Oracle: Java JDK

Click the Java SE Download to see the list of download.

Get the “Windows x86” download if you have 32-bit Windows, and “Windows x64” if you have 64-bit Windows.

Go along and run the downloaded installer file.

Note : Take a note of the directory in which you install the JDK. You will need to add this to the PATH in a later step.

Install Apache Ant

Download Ant from here: ant.apache.org/bindownload.cgi. Get the zip download available at the page.

Click the zip-file link for the most recent release, e.g. apache-ant-1.9.4-bin.zip, and save the file to your machine.

Copy apache-ant folder to path where node.js was installed.

Install Android SDK Tools

Download Android Studio and go through the installer and set up the IDE. It should print out a location for where the Android SDK gets installed. Copy this down for future use.

If you don’t want to download Android Studio you can just download the Android SDK files for Windows here

Go to the page developer.android.com/sdk scroll down the page.

Under “SDK Tools Only”, click the windows installer exe file and download it (this file is named e.g. installer_r23.0.2-windows.exe).

When downloaded, run the installer. You should do fine to use the default settings used by the installer, but make a note of the directory in which the SDK is installed,

Next, inside the new SDK location, we’ll run tools/android to open the Android SDK Manager. We’ll want to install:

  • Android Platform SDK for your targeted version of Android
  • Android Platform-Tools
  • Android SDK build-tools version 19.1.0 or higher
  • Android Support Repository (found under “Extras”)

Accept the license and let the packages install.

Gradle

If you install the Android SDK without ANdroid Studio you have to install Gradle seperatly. Download Gradle from the offical Gradle website

Environment Variables

Now that everything’s installed, we’ll need to set some environment variables for our command line. From the startmenu, search for “System Environment Variables”. From here, we’ll update the user variable PATH and create a new variable of ANDROID_HOME

  • ANDROID_HOME : The path to where the Android SDK is installed.
  • PATH : Two entries, one where Tools are installed for the Android SDK, and another for Platform tools
  • GRADLE_HOME : The path to where gradle is installed

After update environment variables path you must have to system restart.

Now, you should be able to create and build an Android project from the command line.

Create Project

Go to node.js command prompt and run following command.

Go to the directory where you have to create project.

Lets create App with Tabs for that run below command

Ionic start appName tabs

ionic start myAp tabs

Goto myApp directory by run below command

Run app in browser

cd myApp

ionic serve

The Ionic serve will run your application in your browser

Add Platform

Now to build your App in Android, then run below command

ionic cordova platform add android

ionic corodva build android

Run the Application

ionic cordova run android

--

--