Search code examples
androidadtkeystoreandroid-keystore

Convert an existing Keystore to an android debug keystore for eclipse


Sometimes it might be handy to use an existing keystore in eclipse (Android -> Build -> CustomKeystore) to build from within eclipse.

The Eclipse plugin does not allow to change the keystore password, key-alias and key password though.

Is there a way to convert an existing keystore to match the default requirements?


Solution

  • The following keytool commands should do the trick. There definitly is a simpler way, but it already took enough time figuring this one out :)

    keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000
    keytool -delete -alias androiddebugkey -keystore debug.keystore
    keytool -importkeystore -srckeystore src.keystore -destkeystore debug.keystore
    keytool -changealias -alias srcalias -destalias androiddebugkey -keystore debug.keystore
    keytool -keypasswd -alias androiddebugkey -keystore debug.keystore
    
    • This creates a new keystore and imports an existing key from a source keystore
    • keystore. src.keystore -> your source keystore that will be used
    • srcalias -> your source alias you're currently using
    • passwords are entered on cmdline

    use 'keytool -list -keystore debug.keystore' to check the result.