phongap beginning guide step by step
The “Getting Started with Android phonegap” guide from PhoneGap is good, but does not show all pitfalls you may encounter like i did.
You will learn from this Post:
- how to Install Apache Ant
- how to Install Java JDK
- how to Install Eclispe Classic
- Set all needed environment variables (JAVA:HOME, ANT_HOME and so on)
- how to Install the Android ADT Plugin for Eclipse
- How to Install the Android SDK
- How to Intall PhoneGap Apache Cordova 2.2.0
- Avoid the pitfalls while creating Android Projects
Requirements before starting
I will show it step by step don’t worr
- Apache ant
- Java JDK
- Android SDK
- Eclipse Classic
- All Path variables has been set (JAVA_HOME, ANT_HOME, ANDROID_HOME)
Downloading Apache Ant and setting the ANT_HOME variable
got to Apache Ant – Binary Distribution and download the version you want.(any which is latest)
create a folder called ANT in the directory “C:\Program Files\” and unzip file in it. By me it looks : C:\Program Files\ANT\apache-ant-1.8.4
Copy that above path (C:\Program Files\ANT\apache-ant-1.8.4) and set the ANT_HOME path. to do that go to: Start > Search > Advanced System Settings > Environment variable > by System variable >click the button new > and then type in: ANT_HOME and C:\Program Files\ANT\apache-ant-1.8.4 into the fields. After that you must add this new variable to you PATH. Look for Path in the box System variable and press edit. Then add you new ANT_HOME path like this to the and of you Path: %ANT_HOME%\bin;
Download JAVA JDK
First find out which kind of processor your PC supports and then take the version with fits to your PC. 32Bit or 64Bit To find it out which one you have go to Start > System Setting > System and Maintenance > System then you will see the information of your PC like 32bit or 64bit system.
- let’s assume you have installed your Android SDK to the
- you have installed you Apache ant to the
Then you must create two system variables:
Finally, you must modify the
PATH variable and add those two to the end of the
Downloading and install Android SDK
Go to: Android SDK and download. Double click it and install it in the proposed default folder. by me it looks like this: C:\Program Files\Android\android-sdk.
Download Eclipse Classic and installing the Android plugin
Let’s download and install Eclipse now. That’s will be our development tool. Go to Eclipse Downloads and download the classic version version you want. As you know now which platform you have 32bit or 64bit you can take the one which fits to your PC. In my case it is the 32bit version.
Download and install PhoneGap Apache Cordova
Go to: Apache Cordova and download the version you want.
Pitfalls while creating projects
1: Do not create your projects in the same directory as the eclipse workspace. This will result in a failure while trying to open your project later with Eclipse.
2: Do not create a folder to hold your projects. If you do that, that following Step will fail with the statement: This project exits already! in the window command prompt console. This must be done with the create command we will see bellow.
final: That’s the interresting part. go into unziped directory called C:\development\cordova-2.1.0\incubator-cordova-android select the bin folder, press and hold the key shift and press right mouse click. From context menu select open command prompt from here. By me it looks like this:
Loading created project into Eclipse
Now we are almost done! Start Eclipse again and press Ctrl + N and select Android Project from Existing Code > root to your created folder android_projects > select the new created project and press finish. Now we are ready to start.