View Categories

How to create keystore for Android

Keystore file (.jks) is essential for signing your Android applications before publishing them to app stores like Google Playstore

Create an Android Keystore (.jks) File

Prerequisites
Java Development Kit (JDK) Installed: Ensure you have the JDK installed on your system. The keytool utility, used for keystore generation, is part of the JDK.

  1. Open a Terminal or Command Prompt
    • Open Command Prompt/PowerShell (Windows) or your system’s terminal (macOS/Linux).
    • Navigate to the directory where you wish to save your keystore file. For instance, you might create a dedicated ‘keystores’ folder.
  2. Execute the keytool Command
    • Run the following command, replacing the bracketed placeholders with your specific details

Respond to Prompts

The keytool utility will prompt you for the following information. Enter the details carefully

Enter keystore password
Type a strong password for your keystore and press Enter. You will be asked to re-enter it for confirmation. (the characters you type may not be visible)

  1. What is your first and last name? – first_name last_name
  2. What is the name of your organizational unit? – Your Department
  3. What is the name of your organization? – Your Company Name
  4. What is the name of your City or Locality? -Your City
  5. What is the name of your State or Province? – Your State/Province
  6. What is the two-letter country code for this unit? – [US], [IN], [GB]
  7. Is CN=[Your Name], OU=[Org Unit], O=[Org], L=[City], ST=[State], C=[Country] correct? -Type yes and press Enter to confirm the entered information.

Verify Keystore Creation (Optional)

  • After the command completes, a .jks file with the name you specified ([your_keystore_name].jks) will be created in your chosen directory.
  • To verify its contents, you can use
  • You will need to enter your keystore password to view the details.

Important Notes*

Security
Your keystore file is critical for app updates. Keep it secure, backed up, and do not share it. Loss or compromise of this file means you cannot update your app on app stores.

Backup
Back up your .jks file and both your keystore and key alias passwords in a secure, redundant manner.

Validity
The validity 10000 argument sets the key’s validity for approximately 27 years. This long duration is recommended as you must use the same key for all future app updates.

Google Play App Signing
Consider using Google Play App Signing. Google can manage your app signing key, improving security and simplifying key management. You would then sign your app with an upload key (which can be a new key generated similarly) before submitting it to Google Play.

💬
Smart SiteBot
Online
Hi 👋 Ask me anything about this website.