dejpig
Last Updated: February 25, 2016
·
10.22K
· g33konaut
D38ff2119d6ace825b4c7b64e6f422d8

Quickly create, test and build Phonegap/Cordova projects

Phonegap (or respectively Cordova) is really neat, when you wanna build hybrid mobile apps.

The biggest problem with it is the setup and usage - it takes pretty long until you can deploy your first application to a real device.

Gladly, there's the Cordova CLI wrapper in node.js!

$ npm install -g cordova

plus the SDK(s) for the platform(s) you want the app to be built on and you can create a new project for, let's say Android and iOS by running

$ cordova create DemoApp && cd DemoApp
$ cordova platform add ios android

to build your app, you just run
$ cordova build
Note: On iOS I had to manually build the Xcode project after this. Thanks, Apple.
And you find the results in build/<platform>/.
You can also run the emulator / simulator with

$ cordova emulate

or serve the www folder locally (via HTTP) with

$ cordova serve

That speeds up the setup process of new projects enormously.

Say Thanks
Respond

5 Responses
Add your response

11253
C8d26712aa6cb881c7d0506d5a78bed7

When using cordova serve command you have to specify a <platform>, ie: cordova serve android will fire a local server running your android-specific www directory at http://localhost:8000/android/www/index.html. Do you know any way to serve the common www directory with the Cordova built-in server?

over 1 year ago ·
11254
D38ff2119d6ace825b4c7b64e6f422d8

Well, depends on what you want to accomplish.

You can serve it with any static file server BUT you can't use any of the Phonegap APIs...

over 1 year ago ·
11272
C8d26712aa6cb881c7d0506d5a78bed7

That's very interesting, I used Ripple Emulator some time ago to mock the Cordova API but I didn't know this built-in server was already doing the job.

over 1 year ago ·
13346
498f03206bf22bfabc298b3d716209e8

Is there any command to quickly recreate changes. Currently when working with cordova serve all files are static and every change has to be generated again.

over 1 year ago ·
14011
2d5f093edea7d11c9716d72a0a31126e

What's the right way to run the specs (in jasmine) via the CLI (or jasmine:ci)? Are there extra setup/config that needs to happen before you could do it?

over 1 year ago ·
Awesome Job

A3e45f3a cade 11e7 83bc 71c9546a2749
Systems Engineer
·
Fulton, Maryland or Remote
·
Full Time