Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

keystore - Keytool command failure

I tried to create a keystore file for my flutter project (on Windows), which is necessary in order to publish the app on the Google Play Store.

On the flutter website they recommend using the following command:

keytool -genkey -v -keystore c:UsersUSER_NAMEkey.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key

Below that instruction is some additional information:


Note:

The keytool command might not be in your path—it’s part of Java, which is installed as part of Android Studio. For the concrete path, run flutter doctor -v and locate the path printed after ‘Java binary at:’. Then use that fully qualified path replacing java (at the end) with keytool. If your path includes space-separated names, such as Program Files, use platform-appropriate notation for the names. For example, on Mac/Linux use Program Files, and on Windows use "Program Files".

The -storetype JKS tag is only required for Java 9 or newer. As of the Java 9 release, the keystore type defaults to PKS12.


The first command didn't work for me. Thats why I decided follow the steps above.

Here's my flutter doctor -v with the java path:

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) ? Android SDK at C:UsersErickAppDataLocalAndroidsdk ? Platform android-30, build-tools 30.0.3 ? Java binary at: C:Program FilesAndroidAndroid Studiojreinjava ? Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) ? All Android licenses accepted.

And here's the command that should work:

keytool -genkey -v -keystore "c:Program FilesAndroidAndroid Studiojreinkeytool" -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key

Sadly, that one doesn't work too. I even asked a experienced friend of mine for help, but he had no idea.

Here's what my terminal is telling me after I try to create my keyfile (The projects name is sankofa):

C:UsersErickStudioProjectssankofa>keytool -genkey -v -keystore "c:Program FilesAndroidAndroid Studiojreinkeytool" -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key Der Befehl "keytool" ist entweder falsch geschrieben oder konnte nicht gefunden werden.

In English: The "keytool" command is either misspelled or could not be found.

Thank you.

question from:https://stackoverflow.com/questions/65894067/keytool-command-failure

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try this, copy c:Program FilesAndroidAndroid Studiojrein and append into environment variable Path, then open new terminal and type keytool, if it is successful then you can proceed with what you were doing .. try and let me know


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...