简体   繁体   中英

How do you install the keystore in flutter?

I tried to install Keystore in flutter so, inside the terminal, I wrote:

(keytool -genkey -v -keystore c:\Users\USER_NAME\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key)

However, it said:

'key tool' is not recognized as an internal or external command, operable program, or batch file.

And it doesn't work. How can I fix it? Is there something I should add in the Environment variables? (I'm using Windows 10).

Let me say you a quick solution. Better open the command prompt. Go to the folder where you have installed Java: Eg, In my case: it is C.\Program Files\Java\jre1.8.0_211\bin Command Looks like this

cd "C:\Program Files\Java\jre1.8.0_211\bin"

Now try to execute your previous key tool command. If it works so, add the above path to your Environment Variables.
Further Reference: https://flutter.dev/docs/deployment/android#signing-the-app

From the documentation :

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".


For example, if I run futter -v :

...

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\Mendel\AppData\Local\Android\Sdk\tools
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = C:\Users\Mendel\AppData\Local\Android\Sdk\tools
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
...

Locate where it says "Java binary at" and replace the path \java with keytool , So if Java is installed at:

C:\Program Files\Android\Android Studio\jre\bin\java

keytool would be at:

C:\Program Files\Android\Android Studio\jre\bin\keytool

So, for example, to get the debug certificate fingerprint I ran:

"C:\Program Files\Android\Android Studio\jre\bin\keytool" -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore

Here mate click me!

Also you can find out more about exporting your app and making it ready for publishing there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM