First, we need a keystore. If you already have one, you don't need this step:
CMD:
Go to the bin directory of JDK. In this way, the android. keystore file will be generated under this directory. We need this file when signing.
C: \ Program Files \ Java \ jdk1.6.0 _ 10 \ bin> keytool-genkey-alias Android. keystore-keyalg RSA-validity 20000-keystore Android. keystore
Enter the keystore password:
Enter the new password again:
What is your first name and last name?
[UNKNOWN]: qiaoling what is the name of your organization?
[UNKNOWN]: www.chinaandroid.com
What is your organization name?
[UNKNOWN]: www.chinaandroid.com
What is the name of your city or region?
[UNKNOWN]: Haidian
What is the name of your state or province?
[UNKNOWN]: BJ
What is the two-letter country code for this unit?
[UNKNOWN]: 86
CN = qiaoling, ou = www.chinaandroid.com, O = www.chinaandroid.com, L = Haidian, St = BJ, c = 86 correct?
[No]: Y
Enter the primary password of <Android. keystore> (if the password is the same as that of keystore, press Enter ):
Here, the parameter-validity indicates the number of days valid for the certificate. Here we write a maximum of 10000 days. In addition, the password is not displayed again (even if the password is lost), and the tables are all in the password. This password is required when you sign the .apk file.
Then sign:
In eclipse, right-click the project to be signed --> Android tools --> export signed application package...
The following dialog box appears. Select the project to be signed.
Next, select the location and password of the android. keystore file generated above
Next
Next, select the location and name of the file generated by the signature
Finish, get it done...
Source: http://www.cppblog.com/fwxjj/archive/2010/05/24/116208.html