Summary:
Recently idle to have done before the Cordova project, found on the web very few detailed complete configuration tutorial, so I summed up the next share to everyone.
Project Address: Https://github.com/baixuexiyang/hybrid
Environment Construction:
1. Install node. js
Download the installation node.js,https://nodejs.org/en/and use it when installing Cordova. After the installation is complete, perform node-v on the terminal (Win+r,cmd), and if you see a version number as shown, the installation is successful.
2. Install Ant
Download connection: http://apache.dataguru.cn//ant/binaries/, download after the completion of the directory you want to install, such as D:\ant. Then add the directory to the system variables, the steps are as follows: Right click on My Computer, click Properties, left menu click Advanced System Settings, click on the environment variable in the pop-up window, then add the variable ant_home in the user variable, the value is D:\ant, add the variable path, the value is D:\ant\bin, Add the variable classpath, and the value is D:\ant\lib.
After the configuration is done, enter ANT-V in the terminal, if it appears as shown, indicates success.
3. Installing Cordova
Execute the following command at the terminal
Install -G Cordova
Test whether the installation is successful, terminal input cordova-v, if it appears as shown in the following prompt indicates successful installation
Note: Sometimes we install successfully, but execute Cordova command prompt is not internal or external command, this time need to configure our global NPM path in environment variable, find path in user variable, if not new, add value to C:\Users\admin\AppData \ROAMING\NPM (Find your corresponding NPM directory)
4. Installing the JDK
Download http://www.oracle.com/technetwork/java/j ..., choose your own version
5. Installing the SDK
The different Cordova versions correspond to different SDK versions, and the SDK I installed is 5.1.1.
Download sdk,http://www.oracle.com/technetwork/java/j ..., here are the detailed installation steps (http://www.cnblogs.com/zoupeiyang/p/4034 ...)
Note: Install hardware acceleration, need to modify the BIOS virtualization technology to TRUE, the simulator does not start up, remove the hardware.
If all of the above have been completed, then congratulations on your environmental configuration success!
Create your first app:
1. In the terminal, enter the directory you want to create, and execute the following command:
Cordova Create first Com.example.first Firstapp
Cordova Creat is a command to create a project, followed by first for the directory, Com.example.first for the namespace, Firstapp for the app name
2. Add a platform
CD first Cordova platform add Android
Add Android platform, download may be slower
3. Compiling the App
Cordova Build Android
Compile the Android system, and finally, if you see build successful, it's ready.
4. Run the app
Run on simulator
Cordova emulate Android
Run on browser
Cordova serve Android
Browser access to http://localhost:8000 can be
Running on the real machine
Cordova Run Android
Congratulations, your first app is complete!
Common commands:
1. Create an App
Cordova Create first Com.example.first Firstapp
2. Add Platform
Cordova Platform Add Androidcordova Platform add Ioscordova platform add Amazon-Fireoscordova Platform Add BL Ackberry10cordova platform Add Firefoxos
3. View Platform
Ls
4. Delete the platform
RM Android
5. Packaging app
Cordova Build Android
6. Run the app
Cordova Emulate Androidcordova serve Androidcordova run Android
Summarize:
The hybrid app is fast and relatively easy to develop relative to the native app, but it's not as smooth as native, with performance and experience slightly worse. and file size difference is also very large, the same application native as long as a few k, two hybrid but a few trillion.
The following is my own use of Cordova and phonegap development of the news application, welcome to install the use of everyone.
Https://github.com/baixuexiyang/hybrid
Hyper-Detailed Cordova environment configuration (Windows) and instances