一、生成密鑰:keytool -genkey -alias demo.keystore -keyalg RSA -validity 40000 -keystore demo.keystorehtml
二、簽名文件:jarsigner -verbose -keystore demo.keystore -signedjar demo_signed.apk demo.apk demo.keystore優化
若安裝失敗請添加參數「-digestalg SHA1 -sigalg MD5withRSA」後從新簽名安裝.net
若不爽「未提供 -tsa 或 -tsacert, 此 jar 沒有時間戳。若是沒有時間戳, 則在簽名者證書的到期日期 (xxxx-xx-xx) 或之後的任何撤銷日期以後, 用戶可能沒法驗證此 jar。」警告請添加參數「-tsa https://timestamp.geotrust.com/tsa」後從新簽名安裝htm
三、對齊優化:zipalign -v 4 demo_signed.apk final.apkblog
參考:http://www.cnblogs.com/qianxudetianxia/archive/2011/04/09/2010468.htmlip
參考:http://blog.csdn.net/changcsw/article/details/45643607it