先了解两件事情:
- Keytool 是一个有效的安全钥匙和证书的管理工具.
- Android 要求所有的程序必须有签名,否则就不会安装该程序。
生成命令
注意:记得将alias_name改一下。
|
|
之前忘记修改这个名记造成很大问题。这过程中会问你一些问题:
|
|
注意:如果你想要将应用发布到一些应用市场的时候,将保存好你的签名,出现签名不一致的话,就说明有问题了。。。
构建 Android应用
生成 release包
Cordova提供了一组设备相关的API,通过这组API,移动应用能够以JavaScript访问原生的设备功能,如摄像头、麦克风等。
|
|
Method 1: Use jarsigner directly
This is the method I used to use and it isn’t Cordova CLI specific (it’s part of the Java SDK build tools and this method is part of their standard documentation). After you have created your APK (cordova build android --release
) you can run the following command:
|
|
Jarsigner will prompt for the password and sign the APK.
Method 2: Part of the CLI workflow
The ant.properties thing needs an update in this writeup as of today, since Android now uses gradle. For gradle, therelease-signing.properties as mentioned below somehow didn't work for me. I created ‘build-extras.gradle’ (in the same directory as build.gradle i.e. platforms/android) containing the reference to the file containing the keystore information, the content of build-extras.gradle is as follows:
ext.cdvReleaseSigningPropertiesFile='release-signing.properties'
As mentioned in build.gradle this file is always executed (https://cordova.apache.org/doc...
The name of this properties file can be anything, content is signing information like:
storeFile=C:/Users/ra/../key_related/cra_an_key.keystore
storeType=jks
keyAlias=cra
Also I turned to Java 6 (version 23), b'cos of known certificate signing issues. And finally gave the command :
cordova build android -release
参考链接:
http://wincn.net/2015/08/06/Ionic%E6%89%93%E5%8C%85Android%E5%BA%94%E7%94%A8%E6%8C%87%E5%8D%97/
http://ilee.co.uk/Sign-Releases-with-Cordova-Android/