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

17,251

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
Share:
17,251
d3bug_asking_answering
Author by

d3bug_asking_answering

Updated on June 04, 2022

Comments

  • d3bug_asking_answering
    d3bug_asking_answering almost 2 years

    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

  • d3bug_asking_answering
    d3bug_asking_answering about 7 years
    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?
  • petey
    petey about 7 years
    @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: stackoverflow.com/questions/4843212/…
  • d3bug_asking_answering
    d3bug_asking_answering about 7 years
    thank you, my bad, I don't know how to re-use or renew old apk @petey