Android + Eclipse + PHONEGAP environment configuration

Source: Internet
Author: User

After 3 days of time, finally set the environment, depressed n days, and finally finished. Here I just tell you the process of installation, for your reference only.

Environment construction First, you need to download some installation packages:

(Note before downloading, the computer is 32-bit or 64-bit note Select the installation package)

Jdk:http://www.oracle.com/technetwork/java/javase/downloads/index.html of the Java environment

Android Download (this installation includes the development platform for Eclipse): http://developer.android.com/intl/zh-CN/sdk/index.html

PhoneGap Download: http://www.phonegap.cn/?page_id=442#android

(I installed a 64-bit system.) )

First, install the Java JDK. is typically installed directly by default.

Second, the Android compression package is: adt-bundle-windows-x86_64.

After unpacking, go to the Eclipse directory and run Eclipse.exe.

1) Update the Android package first: Select Window-------->android SDK Manager

When all is checked, click Install Packages, and all the packages will be played (I don't know if there is any use, hehe)

2) Configuring the AVD environment

There are two ways of configuring the environment:

1, use the interface to configure, enter the way:

Once opened, click New to create a new line. (I have not tried, so I can only introduce here)

2. Use the command mode to build the AVD environment (I use the way)

Start------> Run------> Input cmd------->cd F:\Documents\adt-bundle-windows-x86_64\sdk\tools (carriage return)

Then enter: Android Create avd-t 4-n android_avd_2.2 (carriage return)

(Be sure to install under ... \sdk\tools, find the place where you unzipped the package: mine is: F:\Documents\adt-bundle-windows-x86_64\sdk\tools)

The installation is complete. If you want to delete after creation, you can use the 1 method to delete the interface.

Third, configuration phonegap (this is more troublesome)

1) Create a new project first.

The specific will not say more, detailed can be viewed:

Http://developer.android.com/intl/zh-CN/training/basics/firstapp/creating-project.html

2) Create a new two folder/libs and/assets/www (probably Libs already)

The PhoneGap package is then decompressed, and the phonegap-phonegap-2.2.0-0-g8a3aa47\phonegap-phonegap-8a3aa47\lib\android is found in the package

Two files in this directory: Cordova-2.2.0.jar and Cordova-2.2.0.js

Copy the cordova-2.2.0.js to the directory/assets/www

Copy the Cordova-2.2.0.jar to the directory/libs

Then click Project to refresh the project by F5,

3) Modify the Mainactivity.java.

There are a total of 3 places to be modified in Mainactivity.java::

Here is a copy of the 3 statements:

Import org.apache.cordova.*;

public class Mainactivity extends droidgap{

Super.loadurl ("file:///android_asset/www/index.html");

4) Modify the document Androimainifest.xml:

Put the code between USES-SDK and application.

[HTML]View Plaincopyprint?
  1. <Supports-screens
  2. android:largescreens="true"
  3. android:normalscreens="true"
  4. android:smallscreens="true"
  5. android:resizeable="true"
  6. android:anydensity="true"/>
  7. <uses-permission android:name="Android.permission.CAMERA" />
  8. <uses-permission android:name="Android.permission.VIBRATE" />
  9. <uses-permission android:name="Android.permission.ACCESS_COARSE_LOCATION" />
  10. <uses-permission android:name="Android.permission.ACCESS_FINE_LOCATION" />
  11. <uses-permission android:name="Android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
  12. <uses-permission android:name="Android.permission.INTERNET" />
  13. <uses-permission android:name="Android.permission.RECEIVE_SMS" />
  14. <uses-permission android:name="Android.permission.RECORD_AUDIO" />
  15. <uses-permission android:name="Android.permission.RECORD_VIDEO"/>
  16. <uses-permission android:name="Android.permission.MODIFY_AUDIO_SETTINGS" />
  17. <uses-permission android:name="Android.permission.READ_CONTACTS" />
  18. <uses-permission android:name="Android.permission.WRITE_CONTACTS" /> /c12>
  19. <uses-permission android:name="Android.permission.WRITE_EXTERNAL_STORAGE" />
  20. <uses-permission android:name="Android.permission.ACCESS_NETWORK_STATE" />
  21. <uses-permission android:name="Android.permission.GET_ACCOUNTS" />
  22.    <uses-permission android: Name= "Android.permission.BROADCAST_STICKY" /> 
 <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 "/> <use S-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.RECORD_VIDEO"/> <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-permissi On android:name= "Android.permission.GET_ACCOUNTS"/> <uses-permission android:name= " Android.permission.BROADCAST_STICKY "/>

Add: android:configchanges= "Orientation|keyboardhidden" in Activity tab

After adding: Two red squares for newly added objects.

Iv. creation of index.html

Index.html Code

[HTML]View Plaincopyprint?
  1. <html>
  2. <head>
  3. <title>hellowworld</title>
  4. </head>
  5. <body>
  6. <p>helloworld</P>
  7. </body>
  8. </html>

Then put the code in your project directory------>assets------->www directory:

The specific red box shows:

Then run the project. (Well done)

Android + Eclipse + PHONEGAP environment configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.