Informatics

Information about various topics

Ads Here

21.10.14

PhoneGap 3 - Setup development Environment for Android on Windows

A guide to start developing with PhoneGap 3 for Android on a Windows machine. 


Requirements


Below platforms / software packages are required:
  • Java JDK 6 or 7
  • Android SDK tools
  • Integrated Development Environment (IDE): Eclipse and Eclipse Plugin
  • Apache Ant
  • GitHub
  • Node.js
  • Cordova PhoneGap

SetUp


Java JDK 6 or 7



Make sure you download JDK. Eclipse can build against Java 6 with Java 7, so it is fine to have only 7 on board. Officially, Android supports only Java 6, so it is not possible to compile/build against Java 7.

Just install the download by following its instruction. Make sure that you have the following set in your => advanced system properties => environment variables.

System variables:


  • JAVA_HOME: C:\Program Files\Java\jdk1.7.0_25
    • The "1.7.0_25" part might be different, depending on which version you are installing.
  • Path: %JAVA_HOME%\bin
    • Add the line above at the end of the rest of the paths and make sure it precedes with an ;

Android SDK tools


Instructions and Downloadable: http://developer.android.com/sdk/index.html

Download the SDK (adt-bundle) from the link above and extract it to a folder. In this case: "C:\AndroidDev\android-sdk\". Make sure that you have the following set in your =>advanced system properties => environment variables.

System variables:
  • Path: C:\AndroidDev\android-sdk\platform-tools;C:\AndroidDev\android-sdk\tools
    • Add the line above at the end of the paths and make sure it precedes with an ;
Start the SDK manager and download the API levels you need (I did Jelly Bean version).

Eclipse and Eclipse Plugin



Eclipse is integrated in the download from the SDK tools. Extract the contents (eclipse) in this case to C:\AndroidDev\eclipse\

When you start Eclipse add the plugins like it is described in the link above. When Eclipse asks for the Android SDK, select folder "C:\AndroidDev\android-sdk\".

User variables:
  • HOME: %USERPROFILE%

Android Studio



Important note: As of this moment it is not possible to build PhoneGap apps with Android Studio.

Apache Ant



Download the file and extract it to (in this case): "C:\AndroidDev\apache-ant"

Make sure that you make you have the following set in your advanced system properties, environment variables.

System variables:
  • ANT_HOME: C:\AndroidDev\apache-ant
  • Path: %ANT_HOME%\bin
    • Add the line above at the end of the rest of the paths and make sure it precedes with an ;

GitHub



Download and install GitHub. Start GitHub and configure anything if needed.

Node.js


Download: http://nodejs.org/

Download the installer from the link above and install it the standard way (next, next.... finish).

It will automatically add it self to the path variables. For reference they are mentioned below here anyway.

User variables:
  • Path: C:\Users\egscrrd\AppData\Roaming\npm
    • Where as Joram is my username and should be yours.
System variables:
  • Path: C:\Program Files\nodejs\

    Cordova PhoneGap

    PhoneGap information (install): https://github.com/mwbrooks/phonegap-cli

    You can now download PhoneGap using the Command Line Interface (CLI). Using this method you can select which platform you need, which plugins you need and then build the sources.

    The commands below are done with cordova, in stead of phonegap. It is possible to them with phonegap also. Personally, I advice to use the phonegap version, in stead of cordova. Somehow using cordova the needed files are not generated properly.

    Difference between Cordova CLI and PhoneGap CLI, according to the FAQ
    The PhoneGap CLI is built on top of the Cordova CLI. It has all of the functionality that the Cordova CLI has. The main difference is that the PhoneGap CLI has PhoneGap Build integration. So if you don’t have the native SDK installed, you can delegate compilation to the PhoneGap Build cloud service and get app-store ready mobile apps. Both tools are completely interoperable.
    The steps (execute either the Cordova or PhoneGap command, not both), for reference I list them both:
    • Download Cordova or PhoneGap, open Command Prompt (cmd), and type the command below.
      • npm install -g cordova
      • npm install -g phonegap

    With this setup you can proceed with your Development .
    To create a Sample application with PhoneGap 3 for Android on Windows please refer below link,
    http://informaticsindian.blogspot.com/2014/10/phonegap-3-sample-mobile-application.html

    No comments:

    Post a Comment