1. Install Eclipse First
2. Download and install the SDK
3. Download and install ADT
4. Download the PhoneGap package in this place, https://codeload.github.com/phonegap/phonegap/legacy.zip/1.0.0
5. The following is the next:
-
- Open Eclipse and click New > Android Project under the File menu
- In the root directory of the project, create two directories:
- Copy the phonegap.js to/assets/www directory from the phonegap you just downloaded
- Copy the Phonegap.jar to/libs directory from the phonegap you just downloaded
- Copy the XML to the/res directory from the phonegap you just downloaded
- M minor adjustments to the main Java file in the src folder of Eclipse: (e.g.)
- Change class inherits from Activity to droidgap
- Replace the Setcontentview () line with the super.loadurl ("file:///android_asset/www/index.html");
- Add import com.phonegap.*;
- Remove import android.app.Activity;
- Here you may encounter an error that eclipse cannot find Phonegap-1.0.0.jar. In this case, right-click the/libs folder to find the build paths/> Configure build Paths. Then add Phonegap-1.0.0.jar to the project in the Libraries tab. If eclipse is not very stable, you need to click F5 to refresh the project once.
- Right-click Androidmanifest.xml and select Open With > Text Editor.
- After copying the following permission settings to Versionname: (for example)
<supports-screens
Android:largescreens= "true"
Android:normalscreens= "true"
Android:smallscreens= "true"
Android:resizeable= "true"
Android:anydensity= "true"
/>
<uses-permission android:name= "Android.permission.CAMERA"/>
<uses-permission android:name= "Android.permission.VIBRATE"/>
<uses-permission android:name= "Android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name= "Android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name= "Android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>
<uses-permission android:name= "Android.permission.INTERNET"/>
<uses-permission android:name= "Android.permission.RECEIVE_SMS"/>
<uses-permission android:name= "Android.permission.RECORD_AUDIO"/>
<uses-permission android:name= "Android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name= "Android.permission.READ_CONTACTS"/>
<uses-permission android:name= "Android.permission.WRITE_CONTACTS"/>
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name= "Android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name= "Android.permission.GET_ACCOUNTS"/>
- Add to the
android:configChanges="orientation|keyboardHidden"
activity tag in androidmanifest. (View image below)
- ADD A second activity under you appliction tag in androidmanifest. (View image below)
<activity android:name="com.phonegap.DroidGap" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"> <intent-filter> </intent-filter> </activity>
-
- Finally run the Android app to!!!!
PhoneGap installation on Eclipse