Android - remove key/alias from keystore
Asked Answered
P

1

9

I have keystore named keystore.jks and accidently two keys are added to it. I have to make a signed apk using key2. Because I have already uploaded an apk using key2, and I want to remove Key1 from keystore.jks.

Signed apk is generating by using Key1 but I need to make it using key2.

Please help me out. Thanks in advance.

Plunge answered 23/5, 2018 at 11:50 Comment(1)
you should ask a detailed question whats happening in android studio when you try to build application and why you are trying to remove one of the alias form keystore fileHorse
S
9

It's regular Java keystore and you manage it using keytool (docs), so

keytool -delete -alias ALIAS -keystore KEYSTORE

and in general keytool -delete -help:

keytool -delete [OPTION]...

Deletes an entry

Options:

 -alias <alias>                  alias name of the entry to process
 -keystore <keystore>            keystore name
 -storepass <arg>                keystore password
 -storetype <storetype>          keystore type
 -providername <providername>    provider name
 -providerclass <providerclass>  provider class name
 -providerarg <arg>              provider argument
 -providerpath <pathlist>        provider classpath
 -v                              verbose output
 -protected                      password through protected mechanism

Signed apk is generating by using Key1 but I need to make it using key2 .

But this can be changed in Android Studio - alias of key used to sign release builds is not hardcoded nor permanent.

Saltatorial answered 23/5, 2018 at 11:55 Comment(1)
The problem is when i am going to generate a signed apk it always give me an error Cannot recover key. So I was assuming that there would be an issue with the key alias (I was wrong).Plunge

© 2022 - 2024 — McMap. All rights reserved.