For cordova3.0, up to 3.6 can be used.
I. preparations:
1. Download node. js URL: http://nodejs.org/
2. Download phonegap
Open the CMD window
Windows: NPM install-G CORDOVA
Mac platform: sudo NPM install-G CORDOVA
After the installation is complete, enter Cordova-version to verify whether the installation is successful.
2. Build an android Development Environment (to avoid Chinese Directories ):
- Download environment jdk1.6 and Android SDK
Android SDK download URL https://developer.android.com/sdk/index.html,
FQ required
2. Configure Environment Variables
Java environment variable configuration: JDK configuration.
Android environment Configuration:
Add the following command after the system variable path:
D: \ Program Files \ ADT \ SDK \ tools;
D: \ Program Files \ ADT \ SDK \ platform-tools;
D: \ ProgramFiles \ ADT \ SDK \ eclipse \ plugins \ org. Apache. ant_1.8.3.v201301120609 \ bin
Verify whether the environment is configured successfully: ant Android-V
Here, the ADT folder is the directory of your android SDK. Replace it with your own.
Virtual Machine environment Configuration:
Because the simulator of Android is very slow to start, the external simulator performs well. I used the startup time for 10 seconds to facilitate development. Download the SDK if necessary.
Http://blog.csdn.net/psvoldemort/article/details/17165265
3. Create a phonegap project file:
- Cordova create Hello com. example. Hello helloworld
- Hello is the folder name, Com. example. Hello is the package path, and helloworld is the class name.
- CD Hello Go To The Hello folder
- Cordova platform add Android or Cordova platform add IOS build different platform projects with different input commands.
- Cordova build Compilation
After the Cordova project is set up, you can directly import the android project using eclipse that comes with the android SDK. IOS can open the platform folder, which contains a proj file, which can be opened using xcode.
Download the Cordova plug-in:
Https://github.com/apacheinstallation documentation for each plug-in.
Iv. iOS development environment construction:
1. Installation http://tieba.baidu.com/p/2847457021 for Mac virtual machines
2. Download node. js and phonegap
3. Download xcode from the Apple Store
Cordova3.x deployment and environment setup tutorial