How do you install the keystore in flutter?

2,588

Solution 1

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

Solution 2

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
Share:
2,588
Admin
Author by

Admin

Updated on December 23, 2022

Comments

  • Admin
    Admin over 1 year

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