Java – Android – Remove key/alias from keystore

Android – Remove key/alias from keystore… here is a solution to the problem.

Android – Remove key/alias from keystore

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

The signed apk was generated using Key1, but I need to use Key2 to generate it.

Please help me. Thanks in advance.


It is a regular Java keystore, and you can use the keytool ( docs ) Manage it, so

keytool -delete -alias ALIAS -keystore KEYSTORE

Generic keytool -delete -help:

keytool -delete [OPTION]...

Deletes an entry


-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 – the key alias used to sign the release is not hard-coded or permanent.

Related Problems and Solutions