Android 项目打包成apk文件
首先,要利用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]: null CN=sxl, OU=xs, O=xuesheng, L=null, ST=null, C=null 正确吗? [否] y 输入<android.keystore>的主密码 (如果和keystore密码相同,按回车):)
[liuaibin@centos6 ~]$ keytool -genkey -alias android.keystore -keyalg RSA -validity 100000 -keystore android.keystore Enter keystore password: Re-enter new password: What is your first and last 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]: null What is the name of your State or Province? [Unknown]: null What is the two-letter country code for this unit? [Unknown]: null Is CN=sxl, OU=xs, O=xs, L=null, ST=null, C=null correct? [no]: y Enter key password for <android.keystore> (RETURN if same as keystore password):
第二,Eclipse Android生成apk文件
1、选择要打包的项目,右键点击–>Androidtools–>ExportSignedApplicationPackage…
2、选择打包的项目
3、选择生成的Eclipse Android.keystore文件并输入密码
4、选择aliaskey并输入密码
5、最后选择生成androidapk文件的目录及文件名
6、最终生成的apk文件