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
Engage
Another key method:
Http://www.iteye.com/topic/343949
Keytool usage:
-Certreq [-V] [-protected]
[-Alias <alias>] [-sigalg <sigalg>]
[-File <csr_file>] [-keypass <keystore password>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Changealias [-V] [-protected]-alias <alias>-destalias <target alias>
[-Keypass <keystore password>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Delete [-V] [-protected]-alias <alias>
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Exportcert [-V] [-RFC] [-protected]
[-Alias <alias>] [-file <authentication File>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Genkeypair [-V] [-protected]
[-Alias <alias>]
[-Keyalg <keyalg>] [-keysize <key size>]
[-Sigalg <sigalg>] [-dname <dname>]
[-Validity <valdays>] [-keypass <keystore password>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Genseckey [-V] [-protected]
[-Alias <alias>] [-keypass <keystore password>]
[-Keyalg <keyalg>] [-keysize <key size>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Help
-Importcert [-V] [-noprompt] [-trustcacerts] [-protected]
[-Alias <alias>]
[-File <authentication File>] [-keypass <keystore password>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Importkeystore [-v]
[-Srckeystore <source keystore>] [-destkeystore <target keystore>]
[-Srcstoretype <source storage type>] [-deststoretype <target storage type>]
[-Srcstorepass <source repository password>] [-deststorepass <target repository password>]
[-Srcprotected] [-destprotected]
[-Srcprovidername <source provider name>]
[-Destprovidername <target provider name>]
[-Srcalias <source alias> [-destalias <target alias>]
[-Srckeypass <source keystore password>] [-destkeypass <target keystore password>]
[-Noprompt]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Keypasswd [-V] [-alias <alias>]
[-Keypass <old keystore password>] [-New <New keystore password>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-List [-v |-RFC] [-protected]
[-Alias <alias>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
-Printcert [-V] [-file <authentication File>]
-Storepasswd [-V] [-New <new repository password>]
[-Keystore <keystore>] [-storepass <keystore password>]
[-Storetype <storage type>] [-providername <Name>]
[-Providerclass <provider Class Name> [-providerarg <parameter>]...
[-Providerpath <path list>]
Jarsigner usage: [Option] JAR file alias
Jarsigner-verify [Option] JAR File
[-Keystore <URL>] keystore location
[-Storepass <password>] password used for keystore integrity
[-Storetype <type>] keystore type
[-Keypass <password>] private key password (if different)
[-Sigfile <File>]. SF/. DSA file name
[-Signedjar <File>] Name of the signed JAR File
[-Digestalg <algorithm>] Name of the digest algorithm
[-Sigalg <algorithm>] signature algorithm name
[-Verify] Verify the signed JAR File
[-Verbose] Output details during signature/Verification
[-Certs] outputs details and displays the certificate during verification
[-TSA <URL>] Location of the timestamp Mechanism
[-Tsacert <alias>] Public Key Certificate of the time stamp organization
[-Altsigner <class>] Class Name of the alternative signature mechanism
[-Altsignerpath <path list>] Location of the alternative signature mechanism
[-Internalsf] contains the. SF file in the signature block.
[-Sectionsonly] does not calculate the hash of the entire list
[-Protected] keystore protected authentication path
[-Providername <Name>] provider name
[-Providerclass <class> name of the encryption service provider
[-Providerarg <parameter>]... main class file and constructor Parameters