Professional Documents
Culture Documents
How To Install - Run PhoneGap On Ubuntu
How To Install - Run PhoneGap On Ubuntu
DasunHegodaTechie
Archives
AboutMe
ContactMe
Navigateto...
Search SearchHere
RecentPosts
CouchbaseClusterDeployment(Installation)onUbuntu
Hadoop2Deployment(Installation)onUbuntu
RESTAPIArchitectureBestPractices
Top10LinuxCommandExamples
HighAvailabilityDeploymentArchitecture
Categories
Architecture
BigData
General
Hacking
Java
Linux
Mac
Mobile
MySQL
NoSQL
OpenData
PHP
PostgreSQL
Security
SoftwareDesign
SQL
Wordpress
dasunhegoda'sTweets
RT@FactSoup:Don'tstressovershityoucan'tchange.about3daysagofromTwitterforAndroid
RT@CiscoSecurity:Ciscoisbuildingthemostrelevant#securityportfoliointheindustry#CLUS
https://t.co/GkmVaWFRZMabout1weekagofromTwitterWebClient
RT@PCMag:10ThingsYouNeedtoKnowAboutMacOSSierra:https://t.co/oagYz2N31chttps://t.co/scEiUBcSVJ
about1weekagofromTwitterWebClient
RT@DZone:62oftheBestMobileDevelopmentBlogs#Mobilehttps://t.co/JiS1HInCErviaMichaelOrgan
https://t.co/fcumMUibx6about1weekagofromTwitterWebClient
RT@Azure:Createyourfree#Azureaccounttoday!Startw/$200incredit&keepgoingw/freeoptions:
https://t.co/MJr2nsRpjZhttps://t.cabout2weeksagofromTwitterWebClient
Follow@dasunhegoda 190followers
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 1/11
7/21/2016 How to install/run PhoneGap on Ubuntu
Howtoinstall/runPhoneGaponUbuntu
Hybridmobileapplicationdevelopmentisahottopicthesedays.PhoneGapisoneoftheframeworksthatcanbeusedto
develophybridmobileapps.Ifyouarenewtohybridmobileapplicationdevelopmentreadthispost.Youonlyhaveto
followthesestepstohaveaPhoneGapappupandrunninginyourUbuntu.Beforethat,
WhatsPhoneGap
PhoneGapisafreeandopensourceframeworkthatallowsyoutocreatemobileappsusingstandardizedweb
APIsfortheplatformsyoucareabout.
SeetheimagebelowforthebuildprocessofPhoneGap.
ImageCourtesy:build.phonegap.com
NotethatYouneedtohaveJavaonyourUbuntu.Letsstart.
1.Installnodejs
1 sudoaptgetupdate
2 sudoaptgetinstallnodejs
Letsinstallnpm,whichistheNode.jspackagemanager.Youcandothisbytyping
1 sudoaptgetinstallnpm
TheNodeJSisinstalled&namedasnodejs.ButPhoneGap,expecttheexecutabletobenamednode.Tofixthis
inconsistency,createasymlinknamednodethatpointstonodejsasfollows.
1 sudolns/usr/bin/nodejs/usr/bin/node
2.InstallGit
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 2/11
7/21/2016 How to install/run PhoneGap on Ubuntu
1 sudoaptgetinstallgit
3.InstallAnt
1 sudoaptgetinstallant
4.InstallPhoneGap
sudonpminstallgphonegap
letsinstalllibrariesthatPhoneGapisdependenton.
1 sudoaptgetinstalllib32z1lib32ncurses5lib32bz21.0lib32stdc++6
typephonegaponthecommandlineandcheckwhetherPhoneGaphasinstalledcorrectlyasshownbelow.
SuccessfulPhonegapInstallation
5.GettheAndroidSDK
YoucandownloadtheSDKhere.Extractthepackageto/usr/local/androidsdkusingbelowcommand.Anyotherpreferred
placewouldbefinebutmakesuretochangethepathaccordingly.
1 sudotarzxvf~/Downloads/androidsdk_r24.0.2linux.tgzC/usr/local/
Ifyouhaveanyissuereferthisthread.CompleteInstallationGuideforAndroidSDK/ADTBundleonUbuntu.
Nowletssettheenvironmentvariablesinthebashconfigurationfile,sothatPhoneGapcancalltheAndroidemulator.
Editthe.bashrcfileasbelow.
1 vim~/.bashrc
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 3/11
7/21/2016 How to install/run PhoneGap on Ubuntu
Addthebelowlines.
exportPATH=$PATH:/usr/local/androidsdklinux/
exportPATH=$PATH:/usr/local/androidsdklinux/tools
exportPATH=$PATH:/usr/local/androidsdklinux/platformtools
exportPATH=$PATH:/usr/local/androidsdklinux/buildtools
Updatethenewlyaddedaliasintheexistingterminal.
1 source~/.bashrc
TypeandroidandseewhetherAndroidSDKManagerisstartedasshownbelow.
AndroidSDKManager
6.Letsinstallafasteremulator
YoucanusetheandroidemulatorifyoureallypreferitbutratherthanusingtheslowandroidemulatortodayIllshowan
emulatorwhichisfasterandbetter.Genymotion.Youmayhavetocreateanaccountdownloadtheappilcation.Alsonote
thataccountwillbeusedatlaterwhenyouruntheapplicationaswell.
Letsdownloadfromthislink.Setthepermissionbeforeyoustartrunningtheapplicationasshownbelow.
1 chmodu+xgenymotion2.1.0_x64.bin
2 ./genymotion2.1.0_x64.bin
YoumightseethebelowerrorifVirtualBoxisnotinstalledinyoursystemwhichisrequiredbyGenymotion.
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 4/11
7/21/2016 How to install/run PhoneGap on Ubuntu
GenemotionInstallError
Belowcommandwillfixtheissue.
1 sudoaptgetinstallvirtualbox
NowletsrunGenymotion.
1 cd/home/dasunhegoda/Downloads/genymotion/
2 ./genymotion
Nowlogintothegenymotionaccountandcreateanemulator.ReferthislinkformoreinfoonsettingupGenymotion.
7.Letscreateaphonegapappilcation
CreateaPhoneGapprojectusingbelowcommand.
1 phonegapcreatetestapp
AddAndroidasaplatformtobebuilt.
1 phonegapplatformaddandroid
Tolisttheavailableplatformtrythebelowcommand(Optional).
1 phonegapplatformls
Nowletruntheapplication.Makesureyouhavestartedyouremulatorsothatapplicationwillbestartedinit.
1 phonegaprunandroid
Tips&Tricks
PhonegapisbuiltonApacheCordova.ApacheCordovaistheenginethatpowersPhoneGap.Thereforeyoucanreplace
someofthePhonegapcommandwithCordova.Ifyoureallywanttoknowtheexactdifferencereadthispost.Istherea
differencebetweenPhoneGapandCordovacommands?Answerishere.Insteadoftyping
1 phonegaprunandroid
type
1 cordovarunandroid
whichwillworkfineaswell.ButwhenyoutypeCordovacommandsyouwillseeamoredetailedoutputthenPhoneGap
commandswhichishelpfulfordebuggingpurposes.SeetheApacheCordovainstallationguidehere.Alsoreferthe
PhoneGapWikiaswell.
Ifyouhaveanyquestionsletmeknowinthecommentsbelow.Yourfeedbackishighlyappreciated(happyface).
30348totalviews,19viewstoday
Don'tForgetToShare
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 5/11
7/21/2016 How to install/run PhoneGap on Ubuntu
DasunHegoda
@dasunhegoda
Hellow!I'mDasunHegoda&I'masoftwareengineer.IwouldliketocallmyselfasatechiewholiveintheInternet.
February16,2015
Linux,Mobile
Android,Cordova,Mobile,PhoneGap
31Comments
31Comments DasunHegoda
1 Login
Jointhediscussion
Trioxin 4monthsago
ifwe'rerunning64bitubuntushouldthosepackagesbethe64bitversions?why32?Doesphonegaprequirethe32bit
versions?Also,I'vealreadygotphonegaptorunandshowmethehelpoutputwithoutinstallingthosepackagesyet.
2 Reply Share
KonradSlepoy amonthago
I'mconfused...Whyisthisallgearedtowardsandroid?Likewhyareweusinganandroidsdkandsuch?Isthatjustfor
testingpurposes?Couldthisjustaseasilybegearedtowardsiosoranotherplatform?Ithoughtthatwasthepointof
phonegap..Itwouldhavebeenhelpfulifyoutalkedaboutthatonsomelevel
Reply Share
AnesP.A 4monthsago
Dearfriends,
whenItrytorun(onmyubuntu15.10)
root@insight:~/testapp#cordovarunandroid
ERRORrunningoneormoreoftheplatforms:AndroidSDKnotfound.Makesurethatitisinstalled.Ifitisnotatthe
defaultlocation,settheANDROID_HOMEenvironmentvariable.
YoumaynothavetherequiredenvironmentorOStorunthisproject
aserror.Pleaseadvise
Thanks
Reply Share
SamianHernandez 4monthsago
Ifinisheduntilsetup#6butthenigetanerrorat#7whenitypedthecommand"phonegapcreatetestapp"
Itthrowsanerror:
module.js:340
throwerr
^
Error:Cannotfindmodule'bplistparser'
atFunction.Module._resolveFilename(module.js:338:15)
atFunction.Module._load(module.js:280:25)
atModule.require(module.js:364:17)
atrequire(module.js:380:17)
atObject.<anonymous>(/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova
lib/node_modules/cordovacommon/src/ConfigChanges/ConfigFile.js:20:14)
atModule._compile(module.js:456:26)
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 6/11
7/21/2016 How to install/run PhoneGap on Ubuntu
atObject.Module._extensions..js(module.js:474:10)
atModule.load(module.js:356:32)
atFunction.Module._load(module.js:312:12)
atModule.require(module.js:364:17)
Pleasehelp.Thanks
Reply Share
adhy>SamianHernandez 4monthsago
Trythislink...
http://askubuntu.com/questions...
Reply Share
EmJiMadhu 7monthsago
ihavefollowedyourinstructions..ihaveinstalledevrythingandriodsdk,emulator,phonegapandeverythingelseyou
mentioned..butwhenigive"phonegap"totestitsinstalled,nothinghappened..notjustthatonealone,butevery
commandwhichinculdesphonegaplike"phonegapplatformls"thergoes,nothinghappen..ifigivecommandsitsjust
goestonextline..thatsall..imusingubuntu14.04
Reply Share
Kev>EmJiMadhu 7monthsago
Itriedinstallingcordova,nodejs,npmandphonegapon14.04andIcouldnotgetittotoworknomatterhow
hardItried.Iupgradedto15.10(latest)andIinstalledcordova,nodejsandnpmfollowingthislink
http://jeffmcmahan.info/blog/i....Andfollowedthistutorialwithoutsomuchasadropofsweat!Backupand
saveallyourdatabecauseIhadaproblemupgradingfrom14.04to15!
Reply Share
AnthonyDobaj 9monthsago
Hi,thanksforofferingyourwisdom.Icannotgetmy
phonegapapptoinstalltheerrorisFailure
[INSTALL_FAILED_UPDATE_INCOMPATIBLE]thetargetisadevice
runningAndroid5.1.1,butphonegapplatformlistonlyshows
android4.1.1.whenIattempttorunphonegapplatformadd
android@5.1.1Igetanerror
Failedtofetch
platformandroid@5.1.1
Probablythisis
eitheraconnectionproblem,orplatformspecisincorrect.
Checkyour
connectionandplatformname/version/URL.
Error:versionnot
found:cordovaandroid@5.1.1
whatshouldItryto
getthisapptoinstall?
Reply Share
http://stackoverflow.com/quest...
Reply Share
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 7/11
7/21/2016 How to install/run PhoneGap on Ubuntu
AnthonyDobaj>DasunHegoda 9monthsago
Thankyouforthat,butItriedeverywayfromSundaytomakesuretheappwasn'talreadyinstalled
wasn'tuntilIstartedusingthephonegapbuildutilitythatIcouldgettheapptoinstallandrun.thatutility
isalittleinconvenient,Imightcomebacktothecommandlinesometimeinthefuture.
Reply Share
adhy 10monthsago
Hi,Thisisagreatarticle.Ifollowedyourinstructions,butihavenotprogressingatpoint5,exactlyonediting./bashrc,
whenitypeandroid,itsays"android:comandnotfound"
whatshouldido?
*sorryformybadenglish.
Reply Share
twicejr>adhy 9monthsago
Forothers:whenyouareusingzshinsteadofbashforexample,edit~/.zshrcinstead.
Reply Share
AnesP.A>DasunHegoda 4monthsago
DearDasun,
Igoterroras"bash:/usr/local/androidsdklinux/tools/android:Permissiondenied".WhatIdo?
Reply Share
AnesP.A>DasunHegoda 4monthsago
WhenItrywithsudogetas
sudo:android:commandnotfound
Reply Share
AnesP.A>DasunHegoda 4monthsago
ThanksDasun,
$sudos
commanddothetrick...
1 Reply Share
adhy>DasunHegoda 10monthsago
okay...ionlyexportpathsviaterminal...
problemsolved...
thankyou
Reply Share
chit ayearago
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 8/11
7/21/2016 How to install/run PhoneGap on Ubuntu
chit ayearago
Hi,Thisisagreatarticle.Ifollowedyourinstructions.Icouldnotinstallthelibrariesmentionedinthearticle.Errors
wereunabletolocatethepackages.Andalsothecommandslistedaftertypingphonegapfromthecommandline,doesn't
listallthecommandsthatyouhave.Ihaveonlythese
Commands:
create<path>createaphonegapproject
build<platform>buildaspecificplatform
install<platform>installaspecificplatform
run<platform>buildandinstallaspecificplatform
local[command]developmentonlocalsystem
remote[command]developmentincloudwithphonegap/build
help[command]outputusageinformation
versionoutputversionnumber
Options:
v,versionoutputversionnumber
h,helpoutputusageinformation
seemore
Reply Share
chit>DasunHegoda ayearago
Thanks..ButIcouldn'tabletoinstallthelibsthatuhavementioned.Igetunabletolocatepackage
Reply Share
noob ayearago
DoIneedtoinstallJDK?
Reply Share
AkshayPatni ayearago
Hi,
Canupleasetellmehowtoinstallphonegaponcentos
Reply Share
http://mohiplanet.blogspot.com...
Reply Share
DickrivenChellemboyee ayearago
Thanksforthisarticle.
Didn'tknowaboutgenymotionandit'sreallygreat:)
Reply Share
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 9/11
7/21/2016 How to install/run PhoneGap on Ubuntu
ManjunathHegade ayearago
Hi,
Installedphonegapusing,,
sudonpminstallgphonegap
but.....
sudoaptgetinstalllib32z1lib32ncurses5lib32bz21.0lib32stdc++6
...isnotworking....errorisgivenbelow
E:Unabletolocatepackagelib32z1
E:Unabletolocatepackagelib32ncurses5
E:Unabletolocatepackagelib32bz21.0
E:Couldn'tfindanypackagebyregex'lib32bz21.0'
E:Unabletolocatepackagelib32stdc++6
E:Couldn'tfindanypackagebyregex'lib32stdc++6
typedphonegapontheterminalbutshowingnothing...
helpme
Thankyouinadvance
Reply Share
sudoaptgetinstallpackagename:i386
Letmeknowifyouneedanyhelp.
2 Reply Share
JulienCoron>DasunHegoda 3monthsago
Hello,
Thefollowingcommanddoesnotwork.Thepackageisnotlocatedtoo.
sudoaptgetinstalllib32z1:i386
Reply Share
ALSOONDASUNHEGODA
ApacheAccessLogstoMySQLDatabase RemoteloginwithGUIinLinuxVNC
3commentsayearago 2commentsayearago
AvatarDasunHegodaThanks.BythewayfranklyspeakingI AvatarDasunHegodaGreat
havetriedthisonly.IfyougoogleI'mprettysureyouwould
findmoreresources.
Hardening&SecuringApacheHTTPServer NiktoTutorialSecurity#ImAWhiteHat
2commentsayearago 1commentayearago
AvatarDasunHegodaThanks AvatarDasunHegodaTherearetutorialsontheweb.Please
google.
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 10/11
7/21/2016 How to install/run PhoneGap on Ubuntu
PreviousPost
NextPost
http://dasunhegoda.com/installrun-phonegap-ubuntu/797/ 11/11