Home > Net >  Flutter Add Keytool
Flutter Add Keytool

Time:11-20

I am trying to add keytool in flutter and I used below code

keytool -genkeypair -v -importkeystore 'C:\Users\MSK\upload-keystore.jks' -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload

Ama bir hata aldım

keytool: The term 'keytool' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
 again.
At line:1 char:1
  keytool -genkeypair -v -importkeystore 'C:\Users\MSK\upload-keystore. ...
  ~~~~~~~
      CategoryInfo          : ObjectNotFound: (keytool:String) [], CommandNotFoundException
      FullyQualifiedErrorId : CommandNotFoundException

What should I do?

CodePudding user response:

I faced this problem once, here is how to solce it:

First, run this in your cmd (command line)

flutter doctor -v

this will Show information about the installed tooling.

Second, in the Android toolchain, search for java binary:

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at C:\Users\acer\AppData\Local\Android\Sdk
• Platform android-32, build-tools 32.0.0
• ANDROID_HOME = C:\Users\acer\AppData\Local\Android\Sdk
• ANDROID_SDK_ROOT = C:\Users\acer\AppData\Local\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java // this one
• Java version OpenJDK Runtime Environment (build 11.0.12 7-b1504.28-7817840)
• All Android licenses accepted.

Third, copy the path of it until /bin/, in my case I will copy this:

C:\Program Files\Android\Android Studio1\jre\bin\

Forth, access that folder, run this command in the cmd (command line)

cd C:\Program Files\Android\Android Studio1\jre\bin\

Fifth, make sure that the keytool command is working:

C:\Program Files\Android\Android Studio1\jre\bin>keytool 

it should list the available commands for keytool.

Finally, run your own keytool command on that path, and it will run normally.

  • Related