For a long time not to update the essay, is busy, but still in continuous learning, today to share with you Cordova configuration and build WebApp hybrid development environment configuration.
You ready? Let's take a step-by-step!!!
1. Configuring the JDK Environment
With the 1.8 version, many places on the internet can be downloaded, there is no link to the
Download install and then configure the SDK environment variables locally, click the Desktop (computer), right-button properties, advanced system settings, System Properties panel advanced, click Environment variables, new in the system variables in the box below
Configure the following three variables, unclear suggestions to Baidu JDK environment variable settings, Baidu said more clearly
Links: http://jingyan.baidu.com/article/6dad5075d1dc40a123e36ea3.html
JAVA_HOME D:\Program Files\Java\jdk1.8.0_112//这个路径根据你安装JDK的环境对应其地址
PATH %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; CLASSPATH
.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar//注意不要漏了前面的点
2.下载Android SDK
Recommended domestic Android-studio Download
Then configure the ANDROID SDK environment, Android_home navigate to the root directory of your SDK folder
ANDROID_HOME D://android-sdk-windows //对应你的SDK文件夹的目录
重启电脑
Cordova installation 1. Download node. js
Node website download and install
2. Run the following command on the Mac terminal and enter the password to install Cordova
sudo npm install -g cordova
Sudo is required for administrator rights,-G is a global installation
CORDVOA official website Command line help
If your computer already has a git friend, you can right-click Git Bash here in a new folder
To perform a npm install -g cordova
command installation Cordova
3. Execute the following code to create a CORDVOA app
Right-click Git Bash here in the new file you said above
输入cordova create hello com.example.hello HelloWorld 回车执行
The first parameter is the file directory, the second parameter is the app ID, and the third parameter is the title displayed
Android Pack 4. Navigate to the Hello Directory folder to install the Platform Module for the project
cd hello执行这条命令:cordova platform add android
5. Generate APK file
执行这条命令:cordova build android
Encounter this problem is Gradle download failed, you can try to take the link in the diagram download and then put it into the corresponding system files, such as, note that the version must correspond to the
C:\Users\Administrator\.gradle\wrapper\dists\gradle-2.14.1-all\4cj8p00t3e5ni9e8iofg8ghvk7
gradle-2.14.1-all.zip
或者android-studio下载
成功就会显示如下
The directory of the APK is as follows:
项目路径\test\platforms\android\build\outputs\apk
6. Change the app desktop icon
In the Cordova build project with the directory to create the res folder will choose their own image of the icon with PS changed size into the folder
And then change the. config file
ldpi:36x36 px
mdpi:48x48 px
hdpi:72x72 px
xhdpi:96x96 px
xxhdpi:144x144 px
xxxhdpi:192x192 px
<platform name="android"> <allow-intent href="market:*" /> <icon src="res/android/36.png" density="ldpi" /><icon src="res/android/48.png" density="mdpi" /><icon src="res/android/72.png" density="hdpi" /><icon src="res/android/96.png" density="xhdpi" /><icon src="res/android/144.png" density="xxhdpi" /><icon src="res/android/192.png" density="xxxhdpi" /> </platform>
然后重新打包App就有图标了。
一切弄好测试成功后,以后要打包什么项目就可以把你要打包的东西放到WWW那个文件里,然后删除platforms文件夹里的东西,再执行
下面这两条命令就可以了,这个环境要小心配置,要不然很容易失败的哦!希望各位配置的朋友都能成功,打包属于我们自己的APP!
cordova platform add android
cordova build android
结束语:今天就分享到这里,谢谢抽出时间阅读的朋友们!
Cordova Configuration and WebApp Hybrid development environment configuration