PgoneGap Installation with Eclipse

Hi Guys,

This tutorial might be helpful to all developer who just started the PhoneGap build technologies. In this tutorial we are going to learn how to configure the PhoneGap with eclipse for android application.

Step -1: You have already android sdk configure with eclipse. If not have then configure the android sdk   or    ADT with eclipse.
Step-2 :  You have to download the new PhoneGap build from Here.
Step-3 :  Now Extract the rar file of PhoneGap in any of your directory in your computer. And go to to extract directory of PhoneGap\phonegap-2.9.0\phonegap-2.9.0\lib\android. Here you have all files that are need to configure with eclipse.


Step 4. Open Eclipse and create the Android Project name PhoneGapDemo.



Now the create the folder www name inside the assets folder and copy the cordova.js file inside the www folder. And copy the cordova2.9.0.jar file from the extaxting folder of phonegap and paste inside the libs folder and copy the xml folder of PhoneGap extract directory and paste inside the res folder of you project.
See the llok of screen.


Now make the java build path and add this cordova.jar file with external directory. See the screen

Step-5: Now create the index.html file inside the www folder. And open the MainActivity.java file and edit Change the base class from Activity to DroidGap. And load the html file like that.


index.html

< html>
< head>
PhoneGap

< /head>

Hello PhoneGap

< /html>

MainActivity.java

package com.sunil.phonegapdemo;

import org.apache.cordova.DroidGap;

import android.os.Bundle;

public class MainActivity extends DroidGap {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }
    
}

Manifest.xml



    

    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
        
            
                

                
            
        
        
            
            
        
    


Run the project.
Cheers Guys!!

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. Extract your zip folder and go inside there phonegap-2.9.1\lib\android

    ReplyDelete
  3. i don't see where the cordova2.9.0.jar file is located...

    ReplyDelete
  4. Hi I dont see any cordova-2.9.1.jar after extracting the phonegap 2.9.1 zip file.

    ReplyDelete
  5. After performing above step, I am able to deploy and run sample app on emulator. But first it give alert with "Class Not Found".

    ReplyDelete
  6. i just started working on it. but in just starting i couldn't find the cordova-3.4.0.jar file and .js file.
    get me out of this trouble.
    thanks a lot.

    ReplyDelete
  7. ha ha ha i also couldn't find i don't know where it is hided....

    ReplyDelete
  8. In order to generate your cordova x.x.x.jar You should follow the instructions given on the second reply on this post http://stackoverflow.com/questions/16637284/where-is-cordova-2-7-0-jar...

    It worked well for me

    ReplyDelete

Post a Comment

Popular posts from this blog

Insert form data into db and validate login Phonegap

Getting data from db and show in listview in Android Apache Cordova

Get Current Location and load on GoogleMap