首先,要利用Android SDK 自带的kdytool生成keystore文件:
keytool -genkey -alias android.keystore -keyalg RSA -validity 100000 -keystore android.keystore参数意义:-validity主要是证书的有效期,写100000天;空格,退格键都算密码。
在DOS里面的过程:
(D:\Program Files\Java\jdk1.7.0_25\bin> keytool -genkey -alias android.keystore -keyalg RSA -validity 100000 -keystore android.keystore
输入keystore密码: android
您的名字与姓氏是什么?
[Unknown]: sxl
您的组织单位名称是什么?
[Unknown]: xs
您的组织名称是什么?
[Unknown]: xs
您所在的城市或区域名称是什么?
[Unknown]:null您所在的州或省份名称是什么?
[Unknown]:null该单位的两字母国家代码是什么
[Unknown]:nullCN=sxl, OU=xs, O=xuesheng, L=null, ST=null, C=null正确吗?
[否] y
输入的主密码
(如果和keystore密码相同,按回车):)
在Linux终端的过程
[[email protected] ~]$ keytool -genkey -alias android.keystore -keyalg RSA -validity 100000 -keystore android.keystore
Enter keystore password:
Re-enter new password:
What is your first andlast name?[Unknown]: sxl
What is the name of your organizational unit?[Unknown]: xs
What is the name of your organization?[Unknown]: xs
What is the name of your City or Locality?[Unknown]:nullWhat is the name of your State or Province?[Unknown]:nullWhat is the two-letter country code for this unit?[Unknown]:nullIs CN=sxl, OU=xs, O=xs, L=null, ST=null, C=null correct?[no]: y
Enter key passwordfor (RETURNif same as keystore password):
第二,Eclipse Android生成apk文件
1、选择要打包的项目,右键点击–>Androidtools–>ExportSignedApplicationPackage…
2、选择打包的项目
3、选择生成的Eclipse Android.keystore文件并输入密码
4、选择aliaskey并输入密码
5、最后选择生成androidapk文件的目录及文件名
6、最终生成的apk文件
原文:http://www.cnblogs.com/sigmon/p/3748765.html