How to Create Keystore File? Android App Signing in Expo 3-Steps Guide
In this article we are going to learn how to create keystore file for android app signing in expo react native. You want to publish your application or create a release build you need to sign the app. In this guide we will walk through the step by step process to do the app signing.
What is a KeyStore File?
A keystore file is an important file when you try to publish your application on Play Store. The file can of .jks extension or .keystore extension. The file contains the apps private signing key. Google play uses this to verify that updates to your application are coming from the same developer. If you lose the keystore file or delete the keystore file by some accident then you wont be able to publish your app updates. Without the original key file you will lose the ability to publish the updates of your app. You will have to again create keystore file and apply in google play console to update you apps keystore file which takes some time to get approved.
Prerequisites To Generate or Create Keystore File
In order to create the keystore file there are some prerequisites. You need to have Java JDK installed (Java 11, 17, or newer) in your machine. Command prompt or terminal access and most important expo project ready for Android build.
You need to verify if the Java is installed or not using the command to create keystore file.
java -version
If the Java is installed correctly you will see the installed Java version.
Steps To Create Keystore File
Step 1. Open terminal or Command Prompt
Navigate to the folder where you want to create keystore file.
Example:
cd Desktop
Step 2. Generate the Keystore file
We can create either .jks file or .keystore file. You can choose as per your will. In order to generate the .jks file you need to run the command
keytool -genkeypair -v -keystore my-release-key.jks -storetype JKS -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
And if you want to create the .keystore file you can use command
keytool -genkeypair -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Step 3. Fill in the required Information
Once you run the command the keytool will ask you several questions. Just the same as below. Fill in the details to create keystore file and make sure you remember them.
Enter keystore password:
Re-enter new password:
What is your first and last name?
John Smith
What is the name of your organizational unit?
Development
What is the name of your organization?
My Company
What is the name of your City?
Mumbai
What is the name of your State?
Maharashtra
What is the two-letter country code?
IN
Is CN=John Smith, OU=Development, O=My Company, L=Mumbai, ST=Maharashtra, C=IN correct?
yes
Once you write yes. Your keystore file will be generated. You can verify by finding file named as my-release-key.keystore or my-release-key.jks in your current directory.
Step 4: Store It Securely After You Create KeyStore File
The generated file is very important you should never upload your Keystore to:
- GitHub
- GitLab
- Bitbucket
- Public cloud storage
Instead you can.
- Store multiple offline backups.
- Save passwords in a secure password manager.
- Keep a copy on an encrypted USB drive.
Best Practices
- You should create the Keystore only once for each app.
- Make sure to back it up in at least three secure locations.
- You should never commit it to version control.
- Always use strong passwords.
- Record the alias and passwords securely.
- Enable Google Play App Signing for added protection.
Frequently Asked Questions
Can I use the same Keystore for multiple apps?
Yes you can use the same keystore for multiple apps. Many developers use a single Keystore with different aliases or even the same alias across multiple apps. However, using separate Keystores for important apps can improve security and organization.
Can Expo generate the Keystore automatically?
Yes. Expo EAS Build can generate and securely manage Android signing credentials for you if you don’t already have one, those who use prebuild can follow the steps above.
What happens if I lose my Keystore?
If you are not enrolled in Google Play App Signing, losing your Keystore can prevent you from publishing updates to your app. Always keep secure backups. But remember not to store it on github or cloud.
Is the .jks file the same as a Keystore?
Yes. The .jks extension stands for Java KeyStore and is the standard format used for Android app signing you can also use .keystore extension.
Read More : How To Fix The Mobile Addiction In Children