ionic build --release android

ionic bulid android

ionic build --release android

keytool -genkey -v -keystore demo.keystore -alias demo.keystore -keyalg RSA -validity 20000

jarsigner -verbose -keystore /yourpath/demo.keystore -signedjar demo_signed.apk demo.apk demo.keystore

zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk

https://github.com/nordnet/cordova-hot-code-push
Signing Your App Manually
You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK. To sign an app in release mode from the command line:

Generate a private key using keytool. For example:

1, keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
2,jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name
3,jarsigner -verify -verbose -certs my_application.apk

/opt/android-sdk-linux/build-tools/21.0.2# ./zipalign  

http://www.phonegap100.com/article-491-1.html

agileek/ionic-framework
4,zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk

 

This example prompts you for passwords for the keystore and key, and to provide the Distinguished Name fields for your key. It then generates the keystore as a file called my-release-key.keystore. The keystore contains a single key, valid for 10000 days. The alias is a name that you will use later when signing your app.
Compile your app in release mode to obtain an unsigned APK.
Sign your app with your private key using jarsigner:
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1
-keystore my-release-key.keystore my_application.apk alias_name
This example prompts you for passwords for the keystore and key. It then modifies the APK in-place to sign it. Note that you can sign an APK multiple times with different keys.
Verify that your APK is signed. For example:
$ jarsigner -verify -verbose -certs my_application.apk
Align the final APK package using zipalign.
$ zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
zipalign ensures that all uncompressed data starts with a particular byte alignment relative to the start of the file, which reduces the amount of RAM consumed by an app.

 

 

 

 

 

 

https://play.google.com/apps/publish/?

 


jarsigner是工具名称,-verbose表示将签名过程中的详细信息打印出来;
-keystore /yourpath/demo.keystore 之前生成的证书
-signedjar demo_signed.apk 签名后的apk
demo.apk 需要签名的apk
demo.keystore 证书的别名

附:查看apk的签名

Mac下,把apk的后缀改为zip打开,然后查看META-INF下的.RSA文件
Windows下,用winner打开apk,同样查看.RSA文件
执行命令

keytool -printcert -file META-INF/CERT.RSA
1
注意后面文件的名称与路径即可,可以查看到签名信息,主要是查看Certificate fingerprints下的MD5与SHA1,这两个不同就代表着签名不同。

转载于:https://www.cnblogs.com/jayruan/p/5178898.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值