Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - remove key/alias from keystore

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.

like image 995
Abubakar Iftikhar Avatar asked May 23 '18 11:05

Abubakar Iftikhar


1 Answers

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.

like image 171
Marcin Orlowski Avatar answered Oct 16 '22 10:10

Marcin Orlowski