Recovering your android keystore lost file
I've been maintaining a React Native app for several years now, I don't update it very often because it's really just a side project I have.
A few years ago I released an Android version, at the time I generated the keystore file and put it in a secure location, but to be honest I don't remember where I stored.
If you are in a similar situation, don't panic! Is quite simple to recover it, actually... you need to create a new one and submit a request to get it updated on the Google Play store.
Step 1
First you need to generate a new key. This key must be a 2048 bit RSA key and have 25-year(9125 days) validity. Open up your terminal and run the following command:
$ keytool -genkeypair -alias prod -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
You are going to be asked a few questions about your organization and your location.
Step 2
Once you have your new keystore file, you need to export the certificate to a pem
format. This is required by Google Play in order for them to update the key. Run the following command in your terminal.
$ keytool -export -rfc -alias prod -file upload_certificate.pem -keystore keystore.jks
Step 3
We are almost done! The last step is to open a new request on Google to update the key for you. Go to https://support.google.com/googleplay/android-developer/contact/key and fill your name and developer account id, you can find this information in the Google Play Console.
Then, select Yes, Google Play manages my upload key
> I have an upload key-related issue
> I lost my upload key
.
After selecting those options, you will see a new field to attach the PEM certificate, go ahead and upload it.
Finally write a message explaining what happened, you can say something like: Unfortunately I've lost my keystore and I'd like to replace it.
.
Click the submit button and done! You will see the confirmation message.
They will get back to you to confirm the request, after that you will be able to use the new keystore file to sign your new release.
Did you like this post?
If you enjoyed this post or learned something new, make sure to subscribe to our newsletter! We will let you know when a new post gets published!