Sample PhoneGap App with Intellij Idea

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"", "url"=>""} on October 28, 2014 · 2 mins read

These are my notes how to get a quick PhoneGap / Cordova sample app running on Uubntu with Intellij Idea.

I'm going to use the sample PhoneGap, jQuery Mobile, Backbone.js app called gthockey-phonegap and posted on GitHub.

Install Cordova & Setup Project

You must already have the node.js packager, npm, installed. Execute these commands to setup the Cordova project

npm install -g cordova

Intellij Setup

Start Intellij and let's create the new project via File > New Project. The select Static web > PhoneGap/Cordova App and Next.

In the dialog box, enter gthockey as the project name and enter the directory where the project will be stored (I'll assume ~/gthockey) Set the executable to /usr/bin/cordova and click Finish.

Pull gthockey-phonegap.git from GitHub

Use the git command to pull the gthockey-phonegap app. This will create a new directory called gthockey-phonegap.

cd ~/gthockey
git clone

Move GTHockey, Build and Run

rm -rf www
mv gthockey-phonegap/www .
cordova platform build android
cordova emulate android

The emulator is very slow, let's enable developer mode on a nearby android device and try running it on the device. Plug the device in and execute the command:

cordova run android


Git is not required for this but I had problems with the Intellij import of a PhoneGap/Cordova project so before we do the import, I'm going to do a backup with Git.

git init
git config --global "YOUR NAME"
git config --global "YOUR EMAIL"
git config --list
git add *
git commit -m 'initial commit'

Intellij Run/Debug Configuration

Click Run > Edit Configurations and then hit the + key and choose PhoneGap/Cordova. In the dialog box change the Name to gthockey, the executable path to /usr/bin/cordova and the working directory to the gthockey directory. Click Ok to save the configuration.

The default setup runs the emulator, change the command field to run if you want it to run on your attached device (much quicker).