Setting up Phone Gap

This week I setup my phone gap environment for development. It wasn’t as simple as I thought it was. Phone gap has a few dependencies needed for it to run and installation is done all via the command line.

Dependencies

Nodejs

nodelogo_big_2

To install phonegap you must use Nodejs’s packages manager – npm

My first step was to install Nodejs.

Upon installing , nodejs creates a local variable to gain access to its features over the command line – one of these features is npm (node package manager) using npm you can install software through the command line.

Java

java

Java is needed for phonegap to be able to compile the project into a android app.

For windows apps you will need the .net framework.

SDK

new-splash

SDK(software developer kit) is also needed to compile the phonegap project. Android studio comes bundled with the SDK so I downloaded android studio.

Installing phone gap

phonegap-logo (1)

With nodejs’s npm all that I need to do is run the command

npm install -g phonegap

installphonegap

Creating a project

Now that phonegap is installed , its time to create a project.

when phonegap is install the system variable is installed with it – phonegap

to create an project I need to run the command: (in the desired directory)

phonegap create appname

phonegap create app

cd to the directory

and add a phone platform

phonegap add platform android

npm will take care of the restadd platform

To emulate my app it need to build then run. During this process I got an error gradlew

After some research into this problem I found a solution. There was something wrong is my .gradel folder. By deleting the .gradle folder phonegap had to fetch a new .gradel folder (via npm) upon build. Doing this fixed the problem.

After building my app I can now run it using the android emulator

phonegap emulate android

Heres where I meet another problem , the emulator is not working. After some research I discovered that I needed a CPU wich supports Intel HAXM . Luckily I was able to change the emulators CPU to ARMemulator cpu

This fixed the problem but it made the emulator run alot slower.

Heres some images of the emulator running

android emulator working

cordova working

Phonegap Build

After some more reading I discoved that phonegap offers an cloud service to build your app

http://build.phonegap.com

All you need to do is zip the app and upload it. Once uploaded there is a QR code you can scan to install the app on your phone. This is a much easier solution and it allows me to test it on my mobile device!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s