1. Step list
- Prepare the dependent environment
- Install cordova
- Create the app, and build
ol>
Two, prepare the dependent environment
1. The installation package that needs to be prepared
Note: After gradle is downloaded, unzip it to a directory on the hard disk; installation steps: java->node->adb-studio
2. Configure the environment variables of the dependent package
2.1 Java environment variables:
New->variable name “JAVA_HOME”, variable value “C:\Program Files\Java\jdk1.8.0_13 1” (i.e. JDK installation path)
Edit->Variable name “Path”, add “;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin” at the end of the original variable value (note the previous; )
New-> Variable name “CLASSPATH “, variable value” .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar “(note that there is a point at the front)
2.2 Configure gradle environment variables:
New->variable GRADLE_HOME, the variable value is the path of gradle: D:\Program Files\gradle-4.1-bin\gradle-4.1
Modify ->Variable Path, that is, add “;%GRADLE_HOME%\bin” (note the preceding; )
3. Install and configure adb-studio
1. Installation is complete After that, open adb-studio and select sdk manager
2. Select the SDK package to install
< p>
3. Configure environment variables for adb
3.1 New -> Variable ANDROID_HOME, the value is the sdk path, as shown in the figure above The displayed android sdk location value
3.2 Edit->Variable path, the value is “;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools”
Three, installation and configuration cordova
1. Modify npm source and install
npm config set registry https://registry.npm.taobao.org npm install -g cordova
Four. Create and package< /h2>
cordova create hello
cordova platform add android
cordova requirements
cordova build android
cordova create hello
cordova platform add android
cordova requirements
cordova build android
Notes
1. Install android sdk for the first time After that, it’s best not to change the path, otherwise the cordova requirements command will fail to run.
2. The virtual machine does not support simulator scheduling
Build successful interface
< img alt="clipboard" width="244" height="49" title="clipboard" style="display: inline; background-image: none;" src="/wp-content/uploads/images/mobile/cordova /1626791694987.png" border="0" >
npm config set registry https:/ /registry.npm.taobao.org npm install -g cordova
cordova create hello
cordova platform add android
cordova requirements
cordova build android
< p>