Introduction:
Phonegap is a Software development framework by Adobe System, which is use to develop mobile applications. To developm apps using Phonegap, the developer does not require to have knowledge of mobile programming language but only web-development languages like Html, CSS and JScript.
This post is all about setting up Phonegap on linux system. After following these steps, you are ready to develop apps using Phonegap.
Steps:
1) Install JDK.
JDK is Java Development kit (which allows you to compile java).
sudo apt-get install oracle-java9-installer or sudo yum install oracle-java9-installer
if you do not have oracle-java9-installer then go for lower version 8 i.e oracle-java8-installer.
sudo update-alternatives --config javaif the above commands display this:
It means you have multiple java installed. Now choose java-9-oracle.
Note: if above command does not show anything , it means you do not have multiple java installed.
2) Download Android Sdk
https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
you can also visit to android website and download sdk for linux.
3) Extract the files and set as environment variable
export PATH=$PATH:/PATH_TO_DOWNLOADED_SDK/android-sdk-linux/platform-tools:PATH_TO_DOWNLOADED_SDK/android-sdk-linux/tools echo $PATH
4) Install android tools using Android SDK Manager
android
click on install packages. it will install all updated packages.
5) For phonegap we are going to use Apache ant build tool.
sudo apt-get install ant
6) install nodejs
sudo apt-get install nodejs
sudo apt-get install npm
npm install -g npm
sudo ln -s /usr/bin/nodejs /usr/bin/nodefirst command install npm tool. Sometimes, few of tools of npm do not get installed. Therefore, second command is to make sure that all the required tools has been successfully installed or not. If not then it will start installing. So do not worry if last command may not install anything.
7) Install phonegap and cordova
npm install -g phonegap@latest npm install -g cordova@latest
8) Create virtual device
android avdif you do not find android command then repeat 3 step.
9) Now you can create your project
cordova create hello com.example.hello HelloWorldyou can add platform now(Android in this case)
cd hello/ cordova platform add android
Now run your project
cordova run androidsometimes, above command fails and ask for packages you will require, in that case repeat step 4 and install the required tools.
Once, device is ready, you can close the emulator and start doing coding in projects www/ folder
We are Done!!
0 comments:
Post a Comment