Setting up your development enivronment to use Apache Cordova

This tutorial covers setting up Apache Cordova, as well as the iOS and Android development environments, required to build the hybrid application.

Apache Cordova

In order to build a Cordova iOS app, you need to install CordovaLib, Cordova Framework and Cordova XCode templates. PhoneGap helpfully provide builds of Cordova 2.0.0.

We recommend you use the latest release, which is 2.0.0 at the time of writing. Download https://github.com/phonegap/phonegap/zipball/2.0.0 and unzip. Take a note of where you unzipped Cordova to; we’ll reference this location throughout the tutorials as <CORDOVA_HOME>.

iOS Build

In order to build a hybrid application for iOS, you’ll need to install the iOS development environment:

  • Mac OS X Lion (10.7) (or later)

  • XCode 4.3 or later and the appropriate iOS SDK for your needs

  • To test on iOS devices instead of the simulator:

    • An Apple Developer account

    • An iOS Development Certificate

    • A provisioning profile for each device you plan to test with

You can read more about Start Developing iOS Apps Today.

Android Build

In order build a hybrid application for Android, you’ll need to install the Android development environment:

  • Java JDK 1.6

  • Android SDK r20 starter package

  • Eclipse Helios (3.6.2) (or later)

    • Android Development Tools (ADT) Plugin for Eclipse

    • Android SDK Tools r20 (included in the Android SDK starter package)

  • At least the Android 2.3 SDK (installed via the Android SDK manager in the ADT)

The Android Developer site provides a step-by-step guide to set up your environment.

Troubleshooting Fedora/Red Hat Enterprise Linux

If you have 64-bit systems, you will need to install some 32bit packages, because Android SDK is 32bit

# sudo yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686

Now, let’s setup an Android Virtual Device in Eclipse. Click on the AVD button:

AVD Button

Click on New…

New AVD

And then create the new AVD, giving it a name of your choice. You should have installed an Android 2.x or 4.0 SDK through the SDK manager (as part of the step-by-step guide above). You should choose this as your target when creating a virtual device.