1. JDK
Environment variable Configuration
Path:c:\program Files\java\jdk1.7.0_79\bin
2. Node. js
Because node. JS's npm is used when installing Cordova
:
http://nodejs.org/
After the download installation is successful, open cmd, enter D disk, create Cordova workspace: mkdir cordovaspace
Test installation Results command: NODE-V
3. Git
Some plugins for later may need to be downloaded using git,
:
http://git-scm.com/
4. Ant
: http://ant.apache.org/bindownload.cgi
After downloading, unzip, I unzip here to D:\Delp_Tool\ant-1.8.2 under,
Then configure the variable ant_home in the environment variable, value: D:\Delp_Tool\ant-1.8.2,
Append%ant_home%\bin to Path;
Test installation Effect command: ANT-V
Note: If you do not install the background operation will be reported to find Ant;
5, Cordova
1) Installation command: NPM install-g Cordova
2) Test installation result command: CORDOVA-V
If the installation of Cordova and Ionic is not responding for a long time, try the following solutions:
I. Through the config command
NPM Config Set Registry https://registry.npm.taobao.org
NPM Info underscore (if configured correctly this command will have string response)
II. Command-line designation
Npm–registry https://registry.npm.taobao.org Info Underscore
Iii. edit ~/.NPMRC Add to the content below
Registry = https://registry.npm.taobao.org
If you encounter npm WARN deprecated [email protected]: Please update to minimatch3.0.2 problem, executable:
NPM install [email protected]
6, Ionic
NPM install-g Ionic
6. Create an App
Here you create an app named Firstapp,id Com.cycle.first, placed under the first folder:
Create command: Cordova Create first COM.CYCLE.FIRSTAPP firstapp-d
The creation process needs to download some Cordova libraries, so wait a moment, and the-D in the command above shows some of the details of the creation process.
7. Add Platform (Note: You must install the SDK for the platform before adding the platform)
1) Installing the SDK
Note: There is a relationship between the Android SDK and the Cordavo version:
3.0 Required is ANDROID-17 (Android 4.2.2)
3.1 and 3.2 require android-18 (Android 4.3)
3.3, 3.4, 3.5 requires android-19 (Android 4.4.2) (simultaneous ant1.8+)
After downloading and installing ADT, you also need to configure the variable android_home in the environment variable, which is worth all the directories in the SDK.
For example, if I install D:\ANDROIDWORKSPACE\ADT\SDK, I will point android_home to this directory, and in path
Additional%android_home%\tools;%android_home%\platform-tools;
Note: Restarting CMD is required after modifying path to take effect.
2) Add Platform
The next commands need to be executed in the app's secondary directory,
Enter FIRST:CD first
Add Android: Cordova Platform Add Android
To add additional platforms:
Cordova Platform Add IOS
Cordova Platform Add Amazon-fireos
Cordova Platform Add Blackberry10
Cordova Platform Add Firefoxos
After you enter, you will start to download the relevant library of Android, and so on ...
Once created, you can use the following command to see which platforms have been added and which can be supported:
Cordova Platforms LS
If you want to delete a platform, you can:
Cordova Platform RM Amazon-fireos
Cordova Platform Remove Android
After adding the./first/platforms directory, add a corresponding platform directory, and delete the platform, will also delete this directory.
8. Compiling the App
Cordova Build
This command compiles the./firstapp/platforms all platforms, if you only want to compile the platform separately, just add the platform name on the build.
Cordova Build Android
Looks like the first time when the compilation is slow ...
The process of compiling will output a bunch of things. Finally, if you see build successful, it's all right.
In fact, the build command is an abbreviation for the prepare and compile two commands. The above command is equivalent to:
Cordova Prepare Android
Cordova Compile Android
9. Test the App
1) test on simulator:
Enter the following command: Cordova emulate Android
However, the data said that the Windows Convert command conflict, the direct "Cordova emulate Android" will be reported Error:spawn ENOENT, the need to start the emulator first.
2) test on the browser:
Enter the following command: Cordova serve Android
Then enter http://localhost:8000 in the browser to see the sub-branch situation.
Note: You can open multiple cmd to run the same app, but the port will start at 8000 +1;
3) test on the device:
Insert USB, enter the following command: Cordova run Android
Android Create install run:
Ionic start MyProject
CD MyProject
Ionic Platform Add Android
Ionic Build Android
Run on Ionic emulate Android emulator
Run on Ionic run Android phone
Reference Documentation:
http://www.aichengxu.com/view/44135
1190000002933971
Problems encountered:
If you encounter the Using this version of the Cordova with older version of the Cordova-andr OID is being deprecated. Consider upgrading to [email protected] or newer.
WORKAROUND: Switch to the project directory, execute Cordova platform Add [email protected]
If you encounter
Line 14:6980 Illegal Instruction node "BASEDIR/NODEMODULES/CORdova/bin/cordova"" @”
The workaround is: Win7 system update: Service Pack 1
Note: Reproduced from http://blog.csdn.net/u012868077/article/details/51588445
161206, Ionic, Angularjs, Cordova build Android development environment