Android + eclipse + phonegap1.7 (Cordova) configuration project.

Source: Internet
Author: User

Install and configure eclipse, Android SDK, and ADT.

1. Go to the eclipse interface and create an android Project New> Android Project

2. Create two documents/libs and/assets/WWW under the project directory

3. Copy the cordova-1.7.0.js under the android directory in phonegap to/assets/WWW,
Copy the cordova-1.7.0.jar in the same directory to/libs

4. Copy the XML folder in the android directory of phonegap to/Res.

5. The default project of Android is for native apps. Therefore, if you want to use a web app (Cordova), you must modify its reference file.
5.1 reference loading cordova-1.7.0.jar, this time you can press F5 to refresh the project.
5.2 remove import Android. App. Activity; add import org. Apache. Cordova .*;
5.3 modify the Java file in the SRC file and change the activity of class extends to droidgap.
5.4 set setcontentview () line with super. loadurl ("file: // android_asset/www/index.html ");

6. Open androidmanifest. xml and copy
<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. 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-Permission Android: Name = "android. Permission. get_accounts"/>
<Uses-Permission Android: Name = "android. Permission. broadcast_sticky"/>
To uses-SDK and application.

Source code and configuration file: http://download.csdn.net/detail/xiaogezq0/4972494

Related Article

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.