I want to update an App on Google Play. I lost the Keystore password, after contacting google support I followed the below-given commands, and they reset the upload key for me.
1. keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
2. keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
Now I have the keystore.jks
file. Now here Problem comes.
I am following these steps in Visual Studio 2019.
Right-click on Myproject.Android > Archive
then getting apk file Bundle Format: apk
Click Distribute > Google Play > Import
then Import an Existing Keystore dialog box it is expecting with an extension of .keystore
file to import but I have .jks
tried to convert it to .keystore
as well but not succeded.
Here is the error I am getting
at Xamarin.AndroidTools.PublicationUtilities.KeyManagement.<>c__DisplayClass13_0.<ImportKeyAsync>b__0(Task`1 t) in C:\A\1\34\s\External\androidtools\Xamarin.AndroidTools\PublicationUtilities\KeyManagement.cs:line 313
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.VisualStudio.Publishing.Presentation.ViewModels.AndroidImportKeyViewModel.<Import>d__48.MoveNext() in C:\A\1\34\s\src\Core\VisualStudio.Publishing\Presentation\ViewModels\AndroidImportKeyViewModel.cs:line 133
Is there anything I am missing?
How I can use keystore.jks
to update my App?
I thought I should post how I resolved this issue if someone else would be facing this issue he might solve it by following these steps.
After getting keystore.jks
file copy your project.Android.apk
and keystore.jks
files to C:\Program Files (x86)\Android\android-sdk\build-tools\30.0.2
location.
run Command Prompt as administrator in given location C:\Program Files (x86)\Android\android-sdk\build-tools\30.0.2
Now you need to zipalign
the apk file manually, run the following commands.
run zipalign -v -p 4 com.project.Android.apk com.projectAligned.Android.apk
then you have to sign apk.
apksigner sign --ks keystore.jks --out com.projectRelease.Android.apk com.projectAligned.Android.apk