Can I merge multiple Android keystore files into o

2019-05-14 01:00发布

问题:

I have got myself into a slightly annoying situation with Android keystore files. Currently I have a few different apps each signed with a different keystore file. Kinda like this:

  • AppName1.apk signed with AppName1.keystore
  • AppName2.apk signed with AppName2.keystore
  • AppName3.apk signed with AppName2.keystore

Each of the keystores contain different names and aliases for each app.

I'm now learning that doing it this way is a bit silly and it would be better to use a single keystore file for all my apps. I am about to publish a new app so I'm trying to get it right this time around.

My general question is, what can I do to make life easier in future?

I've read that I can rename one of they keystores and change the aliases so, in theory, I can sign my next app with one of the existing keystores? That will mean at least 2 of my apps are using the same keystore and it will have a sensible name.


EDIT: For reference, this is one of the tutorials I was reading today:

http://blog.blundell-apps.com/tut-change-alias-passwords-of-your-android-keystore/

and also this other stack overflow answer: Can I change the alias of my key?

It is my understanding from the tutorial that I can safely rename the keystore file, change the passwords and rename the alias without loosing the ability to update the existing app. Can anyone confirm if that's true, or if there is some way I can prove it?


Lastly, I have a 3rd keystore I would like to merge into the other one if that's possible? So ideally, I would like to end up with just one keystore for all 3 apps. I know that's probably pushing it but I'll ask anyway.

Obviously, I don't want to loose the ability to update existing apps.

回答1:

[EDIT]

Now it's possible. Use KeyStore Explorer

[Older Answer Follows]

No

AFAIK, No. A keystore is usually used to identify a developer(or an app publisher). If you have used multiple keystores, you have to keep them all very safe now in order to maintain those applications now.

For now onwards, choose a single keystore and maintain several alias inside it for different applications.

Reference: http://developer.android.com/tools/publishing/app-signing.html



回答2:

Yes You can merge all the keys from different keystores into one. Than there is no need to manage different keystores, you can change the alias of the key also, passwords for the key also, even a new keystore for existing keys.

You need to export all the keys first and than import into the destination keystore.

Remember you can still have different passwords for each key. Keystore password is separate from the key passwords.

Use the KeyStore Explorer



回答3:

You can use keytool -export to export the keys from the old keystore into files an then keytool -import to import into another keystore, applying new aliases or the same than before. See keytool's man page for details of the command line.

I needed to download a fresh Java runtime to get a version of keytool that could open a recent keystore.