1. Install node. js and then install phonegap
Download and install node. js on http://nodejs.org /)
C: \> npm install-g phonegap
Reference http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface)
2. Create a project
C: \> phonegap create hello com. example. hello HelloWorld
3. Write phonegap_android_env.bat to add the PATH. Suppose the latest adt-bundle is decompressed in the directory F: \ adt-bundle-windows-x86-20130219, and the installation PATH of git and java is also required)
@ Set PATH = C: \ WINDOWS
@ Set PATH = C: \ WINDOWS \ system32; % PATH %
@ Set PATH = D: \ java \ apache-ant-1.8.1 \ bin; % PATH %
@ Set JAVA_HOME = D: \ java \ jdk1.6.0 _ 20
@ Set PATH = D: \ java \ jdk1.6.0 _ 20 \ bin; % PATH %
@ Set PATH = F: \ adt-bundle-windows-x86-20130219 \ sdk \ platform-tools; % PATH %
@ Set PATH = F: \ adt-bundle-windows-x86-20130219 \ sdk \ tools; % PATH %
@ Set PATH = D: \ ugame \ bin \ git \ bin; % PATH %
@ Cd/D "C :\"
Call "C: \ Program Files \ nodejs \ nodevars. bat"
@ Cmd
Otherwise, errors may occur when phonegap-V build android)
4. Compile the hello Project
Run phonegap_android_env.bat first)
C:> cd hello
C: \ hello> phonegap-V build android
Use-V to check for errors)
5. Plug in the device and install and run it.
C: \ hello> phonegap run android
6. Custom webpage
Modify C: \ hello \ www \ index.html to modify html code) and C: \ hello \ www \ config.xmlspecify index.html path name)
The generated code is in the C: \ hello \ platforms \ android directory.
For the code above 3.0's, if you do not fill in the question, just change the cordova-xxx.js in the. html file to phonegap. js)
Note that phonegap. js does not exist in the C: \ hello \ www \ directory. This file will only appear in the output directory C: \ hello \ platforms \ android.
7. The installation plug-in can be selected. You can add the directory where git.exe is located to the PATH)
C: \ hello> phonegap local plugin add git: // github.com/apache/cordova-plugin-device.git
Note: Search for cordova-plugin in the search bar of https://github.com/apache)
The download will output to C: \ hello \ plugins \ org. apache. cordova. core. device
The Java code of the plug-in is used as the. java file, and the js Code is output to the corresponding directory of C: \ hello \ platforms \ android as the. js file.
C: \ hello \ platforms \ android \ src \ org \ apache \ cordova \ device \ Device. java
C: \ hello \ platforms \ android \ assets \ www \ plugins \ org. apache. cordova. core. device \ www \ device. js
C: \ hello \ platforms \ android \ res \ xml \ config. xml
Other files may change)
8. Remove the plug-in
C: \ hello> phonegap local plugin list
[Phonegap] org. apache. cordova. core. device
C: \ hello> phonegap local plugin remove org. apache. cordova. core. device
[Phonegap] removing the plugin: org. apache. cordova. core. device
[Phonegap] successfully removed the plugin
All plug-in-related code is removed, including the code for git clone to local)
This article from the "weimingtom heart-to-heart" blog, please be sure to keep this source http://weimingtom.blog.51cto.com/5787478/1295472