---
title: "How to Install and Setup Apache Cordova"  
description: "This article describes you, how to install Apache Cordova and the Android SDK on a Windows machine. This is a quite complex process, which may take so"  
author: "Anonymous User"  
published: 2017-04-14  
updated: 2018-03-19  
canonical: https://www.mindstick.com/blog/11352/how-to-install-and-setup-apache-cordova  
category: "apache cordova"  
tags: ["mobile development", "apache", "cordova", "apache cordova"]  
reading_time: 3 minutes  

---

# How to Install and Setup Apache Cordova

This article describes you, how to install **Apache Cordova** and the Android SDK on a Windows machine. This is a quite complex process, which may take some time, but I suggest you to have patience and keep the things going.

## Installing the Cordova CLI

The Cordova command-line tool is distributed as an npm package.

To install the cordova command-line tool, follow these steps:

**1.**Download and [install Node.js](https://www.mindstick.com/Articles/1454/install-and-setup-node-js). On installation you should be able to invoke node and npm command on your [command line](https://www.mindstick.com/forum/158085/how-do-i-pass-command-line-arguments-to-a-node-js-program).

**2.**(Optional) [Download and install](https://www.mindstick.com/forum/145525/download-and-install-bluestacks-on-linux-computer) a git client, [if you don](https://www.mindstick.com/forum/159346/how-is-the-exception-handled-if-you-don-t-catch-it)'t already have one. Following installation, you should be able to invoke git on your command line. The CLI uses it to download assets when they are referenced using a url to a git repo.

**3.**Lastly, install the cordova framework using npm utility of Node.js. The cordova module will automatically be downloaded by the npm utility.

\

**Also Read: [Guide to install and Setup Node.js](https://www.mindstick.com/Articles/1454/install-and-setup-node-js)**\

\

**On OS X and Linux:**

**$ sudo npm install -g cordova**

On OS X and Linux, prefixing the npm command with sudo may be necessary to install this development utility in otherwise restricted directories such as /usr/local/share. If you are using the optional nvm/nave tool or have write access to the install directory, you may be able to omit the sudo prefix.

**On Windows:**

```
    C:\>npm install -g cordova
```

**\**The -g flag above tells npm to install cordova globally. Otherwise it will be installed in the node_modules subdirectory of the current working directory.

After installation completion, you should be able to run cordova on the command line with no arguments and it should print help text.

**Create the App**

Go to the directory where you [maintain your](https://answers.mindstick.com/qa/99988/how-to-maintain-your-health-during-summers) [source code](https://www.mindstick.com/forum/33476/pls-send-me-source-code-for-changing-passward-in-asp-dot-net-i-tried-so-much-from-google-but-its-not-workining), and create a cordova project:

```
       $ cordova create hello com.example.hello HelloWorld
```

This creates the required directory structure for your cordova app. The cordova created script generates a skeletal web-based application whose [home page](https://answers.mindstick.com/qa/95562/how-do-i-change-the-safari-home-page-on-a-mac) is the project's www/index.html file, by default.

**Add Platforms**

All subsequent commands need to be run within the project's directory, or any subdirectories:

```
$ cd hello
```

Add the platforms that you want to target your app. We will add the 'ios' and 'android' platform and ensure they get saved to config.xml:

```
$ cordova platform add ios --save
$ cordova platform add android --save 
```

**To check your current set of platforms:**

```
$ cordova platform ls
```

**\**Running commands to [add or remove](https://www.mindstick.com/forum/160320/how-you-can-check-if-an-element-exists-in-a-set-and-add-or-remove-elements-from-it) platforms affects the contents of the project's platforms directory, where each specified platform appears as a subdirectory.

**Note:** When using the CLI to build [your application](https://www.mindstick.com/forum/34702/please-tell-me-what-is-cross-site-scripting-and-how-is-it-harmful-for-your-application), you should not edit any files in the /platforms/ directory. The files in this directory are overwritten timely when preparing applications for building, or when plugins are re-installed.

**Install pre-requisites for building**

To build and run apps, you need to install SDKs for each platform you wish to target. On the contrary, if you are using browser for development you can use browser platform which does not require any platform SDKs

**To check if you satisfy requirements for building the platform:**

```
$ cordova requirements
Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: installed android-19,android-21,android-22,android-23,Google Inc.:Google APIs:19,Google Inc.:Google APIs (x86 System Image):19,Google Inc.:Google APIs:23
```

```
Gradle: installed Requirements check results for ios: Apple OS X: not installed Cordova tooling for iOS requires Apple OS X Error: Some of requirements check failed
```

**\**

---

Original Source: https://www.mindstick.com/blog/11352/how-to-install-and-setup-apache-cordova

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
