PhoneGap's Cordova build Android app

Source: Internet
Author: User



PhoneGap is the powerful software to open Android app through HTML5, it's the advent of the second kill all learn mobile Android, iOS software niche.

As a front-end HTML5 developer, I cannot help but say that this software benefits human beings.


First PhoneGap needs to install the following software:

Nasty:Eclipse(I am also drunk, a learning front-end, press this Java thing, let me think for a long time)

SDK Manager

node. js

Git (so I can get the PhoneGap plugin automatically)


Specific content official online too detailed, I will not bother, and the version of the different, the installation of the method is not the same ...



Let me just say, as a front-end engineer, how to do as little as possible without eclipse.


let's get started.

One:

Be sure to follow the official website, the Android SDK Androd API tools installed (I use the api22,android4.0), if the card can not install virtual machine Oh!

Configure the Android environment variable (if not configured, the following Cordova run ANDROID command error): Android_home,android_path,android_tools, add three variables to the PATH variable Amount of

both :

Now you need to install the Cordova toolset via the node. js command line NPM

$ sudo npm install -g cordova
Three:

Build my app through the Cordova command set, as follows:


  $ cordova Create   "folder name"    COM   example   hello   "app icon name"   
"Folder name"
At this time, you have to put your code in the root directory of the WWW, the www to have the cordova.js file, continue as follows:

    $ cordova platform add android
After creating the Android version of the code, we need to install the Android plugin we need to better invoke the local features on the device.

If you are calling a plugin for the first time, you need to download the reference plugin from the Web using the following command:

$ cordova plugin add org.apache.cordova.device
To delete a plugin:


$ cordova plugin rm org.apache.cordova.device
If you are not the first to call a plug-in, you can set the root directory of CONFIG. Platforms\android\res\xml\config.xml, which will be synchronized to the following, automatically install the local existing plugins:

    <feature name= "Whitelist" >        <param name= "Android-package" value= " Org.apache.cordova.whitelist.WhitelistPlugin "/>        <param name=" onload "value=" true "/>    </ feature>    <feature name= "Notification" >        <param name= "Android-package" value= " Org.apache.cordova.dialogs.Notification "/>    </feature>    <feature name=" Vibration ">        <param name= "Android-package" value= "org.apache.cordova.vibration.Vibration"/>    </feature>    <feature name= "Streamingmedia" >        <param name= "Android-package" value= " Com.hutchind.cordova.plugins.streamingmedia.StreamingMedia "/>    </feature>    <feature name=" Device ">        <param name=" android-package "value=" Org.apache.cordova.device.Device "/>    </ Feature>

Four :

by trying, I was unable to implement Cordova build Android and Cordova run Android, so I connected the phone install app by importing the Android directory code into eclipse.

If you need to modify the code, you only need to modify the code in the Android directory.




    • Useful Links:
    • PhoneGap various plugins

    • PhoneGap Chinese API documentation


















PhoneGap's Cordova build Android app

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.