PhoneGap installation on Eclipse

Source: Internet
Author: User

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:
            • /libs
            • /assets/www
          • 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>
        • 4. Hello World

          Create a new file index.html in the "/assets/www" directory and paste the following code:

          <!DOCTYPE HTML>
          <title>PhoneGap</title>
          <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
          <body>
          </body>
    • Finally run the Android app to!!!!

PhoneGap installation on Eclipse

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.