How to install Phonegap in Ubuntu?

| | 2 min read

PhoneGap is an open source based Mobile App Development Framework. It is also known as Apache Cordova. Every mobile operating system providers have their own set tools and environments for developing application. Application made for one operating system and it's not support other operating systems. Developers using different frameworks and languages to building mobile applications for each devices- iPhone, Android, Windows Mobile etc. PhoneGap solve the above mentioned problem. Are you searching for an App Development, ping us quickly.

In PhoneGap, developers develop their Apps using standard web APIs for all major mobile operating systems. Developers needed only the basic knowledge of Java scripts, HTML and CSS. Following are the steps to install PhoneGap.

Installation of Java :

Check if Java is not already installed on your system: Open terminal and Type java -version and press Enter.

java -version

Return Java version if available java in your system. Otherwise install java using the following commands.

sudo apt-get install default-jre
sudo apt-get install default-jdk

Installation of nodejs and npm :

Node.js is a JavaScript platform for server-side programming. Node.js allows users to build network applications quickly. In most cases, you want to install npm. Npm is the package manager of Node.js.

sudo apt-get install nodejs
sudo apt-get install npm

The NodeJS is installed & named as nodejs. But PhoneGap, always execute using the name node. So create a symlink named node that points to nodejs for fix this inconsistency.

sudo ln -s /usr/bin/nodejs /usr/bin/node

Installation of Ant :

sudo apt-get install ant

Install PhoneGap and depending libraries of PhoneGap.

sudo npm install -g phonegap
sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6

Download Android SDK and extract to /usr/local/. Give the executable permission for path/android-sdk-linux/tools/android.

sudo tar -zxvf ~/Downloads/android-sdk_r24.0.2-linux.tgz -C /usr/local/
sudo chmod a+x /usr/local/android-sdk-linux/tools/android

Edit the .bashrc file and Set the environment variables in the bash configuration file.

vim ~/.bashrc

Then add the following lines to the end part of the file.

export PATH=$PATH:/usr/local/android-sdk-linux/
export PATH=$PATH:/usr/local/android-sdk-linux/tools
export PATH=$PATH:/usr/local/android-sdk-linux/platform-tools
export PATH=$PATH:/usr/local/android-sdk-linux/build-tools

Save the file. Update the newly added alias in the existing terminal.

source ~/.bashrc

Create PhoneGap application using the following commands:

phonegap create testapp

To read more mobile applications like this, click this link. Do you need any drupal solutions, get it from here.