## Installing Cordova

To install Cordova:

sudo apt-get install nodejs

NodeJs is an Open Source server environment.

sudo apt-get install npm

Npm is a registry package.

sudo apt-get install git

Git is is a decentralized versioning system.
sudo npm install -g cordova

This line will install Cordova.

Once done, if you execute:

cordova

You should already getting an answer from the CLI that Cordova is installed. Then create a folder, name it like you want and go within it, once there execute:

cordova create hello com.example.hello HelloWorld

hello is the name of your project, HelloWorld the name of your app.

Then you modify everything that you have to modify within the www folder as you would do for any website.

Then you need to indicate on which platform you wish to build it for:

cordova platform add android

In this case it will add all the necessary files to Cordova in order to create apps for Android.

Then you need to build the file to have it on your smartphone, in the case of Android it will be the .apk file:

cordova build --android

It may be possible that you are getting a message such as this one:

"Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory."

This message means that the Android SDK is not installed yet on your computer. So you need to go on the Android official website and download and install it on your computer: https://developer.android.com/studio. There are packages for each operating system.

Once the file downloaded, unzip it where you want on your computer.

In my case this file is now accessible as: /home/myusername/sdk-tools-linux-4333796

Then you need to configure ANDROID_HOME, in my case it will be:

export ANDROID_HOME=$HOME/sdk-tools-linux-4333796 export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:\$ANDROID_HOME/platform-tools

Once done, you will see that they will ask you to install Android Studio as well.

it will generate normally the .apk file. And then you are good to go.

##### How to launch the emulator with Cordova?

Last modified: Wednesday, 27 November 2019, 9:27 PM