Wednesday, March 19, 2014

Generate Android Key using Command Line

We need Android Key while developing an Android application. Sometimes we need to set in our editor in-order to generate an android build. So, how we can generate an Android Key?

There are many ways to generate Android Key like, by using Eclipse tool and by using command line. Here we will discuss how we can generate an Android key using command line.

System Requirements: Install latest JDK in your system.

  • Open command line by "Run as Administrator" option.
  • Go to bin folder of JDK installation, for me it's "C:\Program Files\Java\jdk1.6.0_35\bin", for you it may be different path.
  • Then type the following command:
keytool -genkey -v -keystore expensetracker.keystore -alias expensetracker -keyalg RSA -keysize 2048 -validity 10000

Here, expensetracker.keystore is the key store name and expensetracker in blue colored is the alias name.
Below is the screen shot:

Then you have to enter keystore password in the command prompt as shown below:

You can provide any key with minimum 6 length and just a note whenever you will type your password you can't see it typing in command prompt. Then it will ask other information like first name, last name, Organization Unit.., you ca provide any value as per your wish as shown below:

Then it will ask to confirm your information, type "yes" and press "Enter". Then it will ask for entering Key password, you can keep key password same as keystore or you can give a different password it's your choice then you will see a success message in the command line "Storing expensetracker.keystore" as below:

So, your key is generated and it's present in the bin folder. Go to the bin folder of the JDK and search there with file name "expensetracker.keystore". If you have provided a different keystore name then you have to search using that name. Here you will get the keystore as shown below:

We got the keystore file and can use anywhere for Android App development.

No comments:

Post a Comment