Search code examples
androidapksigned-apk

Generate signed apk android studio - Error with key


I am trying to generate signed apk with an exiting keystore but i have following problem

Error:org.gradle.tooling.BuildException: Failed to read key MedicalAssistanceKey from store "D:\MedicalAsError:com.android.ide.common.signing.KeytoolException: Failed to read key MedicalAssistanceKey from store

 "D:\MedicalAss_download\MyKey.jks": Cannot recover keys_download\MyKey.jks": Cannot recover key

Error:java.security.UnrecoverableKeyException: Cannot recover key

I am sure the password and key are correct


Solution

  • The keystore and key passwords have to be the same. You could use commands to modify passwork as below:

    keytool -storepasswd -new [insert new keystore password] -keystore [insert keystore file name]
    
    keytool -keypasswd -alias [insert alias] -new [insert new key password] -keystore [insert keystore file name]
    

    Or if you like GUI, download from http://keystore-explorer.org/

    Note: keytool.exe exists in jdk/bin folder or jre/bin folder.