Android
步骤 1: 转到项目的根目录并打开命令行提示符
cordova build --release android
这会在\ platforms \ android \ build \ outputs \ apk 下生成一个带有名称的 unsigned apk
Android 的版本,unsigned.apk
第 2 步: 获取签名 apk 的密钥生成
句法:
keytool -genkey -v -keystore <keystoreName>.keystore -alias <Keystore AliasName> -keyalg <Key algorithm> -keysize <Key size> -validity <Key Validity in Days>
例:
keytool -genkey -v -keystore ExampleApp.keystore -alias TestExampleApp -keyalg RSA -keysize 2048 -validity 10000
keystore password? : xxxxxxx
What is your first and last name? : xxxxxx
What is the name of your organizational unit? : xxxxxxxx
What is the name of your organization? : xxxxxxxxx
What is the name of your City or Locality? : xxxxxxx
What is the name of your State or Province? : xxxxx
What is the two-letter country code for this unit? : xxx
密钥库是在名为 ExampleApp.keystore 的同一文件夹中生成的
步骤 3: 将生成的密钥库移动到 \ platforms \ android \ build \ outputs \ apk
在 \ platforms \ android \ build \ outputs \ apk 下的命令提示符下运行 jarsigner 工具 ******
句法:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystorename <Unsigned APK file> <Keystore Alias name>
例:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ExampleApp.keystore android-release-unsigned.apk TestExampleApp
这将生成具有相同名称的签名 apk。
第 4 步: zip 对齐工具来优化 APK
zipalign -v 4 android-release-unsigned.apk android.apk
zipalign 位于\ Android \ sdk \ build-tools \ 23.0.3 \ zipalign 下
这将生成一个名为 android.apk 的已签名 apk,现在可以将其上传到 app store