6

I'm trying to generate a keystore with these line of code

keytool -genkey -v keystore app-key.keystore alias app-key -keyalg RSA -keysize 2048 -validity 10000

but showing

Illegal option: keystore
keytool -genkeypair[OPTION]...

is this a new error? I'm using mac terminal and trying to deploy android in google playstore

1 Answers1

9

In your command, you are missing a few "-" before keystore & alias

keytool -genkey -v -keystore app-key.keystore 
    -alias app-key -keyalg RSA -keysize 2048 -validity 10000

Here are all the legal options for keytool -genkey usage, please note that "-" is required for valid usage:

-alias <alias>                  alias name of the entry to process
-keyalg <keyalg>                key algorithm name
-keysize <keysize>              key bit size
-sigalg <sigalg>                signature algorithm name
-destalias <destalias>          destination alias
-dname <dname>                  distinguished name
-startdate <startdate>          certificate validity start date/time
-ext <value>                    X.509 extension
-validity <valDays>             validity number of days
-keypass <arg>                  key password
-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

You may bring up these list of options any time by running

keytool -genkey -help
petey
  • 16,914
  • 6
  • 65
  • 97
  • After trying to create new apk and upload it, it shows error: You uploaded an APK that is signed with a different certificate to your previous APKs. You must use the same certificate. Your existing APKs are signed with the certificate(s) with fingerprint(s): SHA1 ***** and the certificate(s) used to sign the APK you uploaded have fingerprint(s): SHA1 ***** What should I do? – d3bug_asking_answering Feb 16 '17 at 18:52
  • @Jaze . sorry to hear that. For that new problem you will want to locate the keystore that was previously used for those older apks. This question is similar to your new question: http://stackoverflow.com/questions/4843212/the-apk-must-be-signed-with-the-same-certificates-as-the-previous-version – petey Feb 16 '17 at 19:09
  • thank you, my bad, I don't know how to re-use or renew old apk @petey – d3bug_asking_answering Feb 16 '17 at 19:15