其實還是挺簡單的。
1. 通過java自帶的keytool工具,創建release版的keystore
- keytool -genkey -v -keystore keystore_name.keystore
- -alias alias_name -keyalg RSA -validity 10000
keystore_name.keystore:要創建的release版keystore的文件名
alias_name:別名?取個好記點的名字吧,後面還要用到的
-keyalg RSA:通過RSA算法生成
-validity 10000:有效期,單位是天
如果java環境配置正常,輸入命令後會出現下列信息
Enter keystore password:(keystore的密碼)
Re-enter new password:(確認keystore的密碼)
What is your first and last name?
[Unknown]: (姓名,用自己喜歡的名字吧,不知道會顯示在哪裏)
What is the name of your organizational unit?
[Unknown]: (組織單位)
What is the name of your organization?
[Unknown]: (組織,不知道和上面那個有什麼區別)
What is the name of your City or Locality?
[Unknown]: (城市)
What is the name of your State or Province?
[Unknown]: (州,省,縣)
What is the two-letter country code for this unit?
[Unknown]: CN
Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN correct?
[no]: yes (確認輸入的信息)
Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with
a validity of 10,000 days
for: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN
Enter key password for
(RETURN if same as keystore password):(alias的密碼,如果和keytore密碼一致,直接回車)
Re-enter new password:(確認alias的密碼)
[Storing my-release-key.keystore]
2. 創建release版的apk文件
在Eclipse中,右鍵要發佈的項目,依次選擇Android Tool -> Export Signed Application Package...
然後就是step-by-step了,選擇剛纔生成的release版keystore,輸入密碼,選擇alias,輸入alias密碼,生成release版的apk。
啊,世界清靜了~~~
最後就是安裝了。
由於使用了新的簽名,必須先卸載原來安裝的程序纔可以安裝。