简体   繁体   English

如何在 flutter 中安装密钥库?

[英]How do you install the keystore in flutter?

I tried to install Keystore in flutter so, inside the terminal, I wrote:我尝试在 flutter 中安装 Keystore,所以在终端内,我写道:

(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). (我使用的是 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 Go 到您安装 Java 的文件夹中: 例如,在我的情况下:它是 C._0211\Java\jre1.8。

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进一步参考: 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. keytool 命令可能不在您的路径中 - 它是 Java 的一部分,它作为 Android Studio 的一部分安装。 For the concrete path, run flutter doctor -v and locate the path printed after 'Java binary at:'.对于具体路径,运行flutter doctor -v并找到打印在“Java binary at:”之后的路径。 Then use that fully qualified path replacing java (at the end) with keytool.然后使用该完全限定的路径用 keytool 替换 java(最后)。 If your path includes space-separated names, such as Program Files, use platform-appropriate notation for the names.如果您的路径包含以空格分隔的名称,例如 Program Files,请使用适合平台的表示法作为名称。 For example, on Mac/Linux use Program\ Files , and on Windows use `Program Files".例如,在 Mac/Linux 上使用Program\ Files ,在 Windows 上使用“Program Files”。


For example, if I run futter -v :例如,如果我运行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:找到它说"Java binary at"的位置并将路径\java替换为keytool ,因此如果 Java 安装在:

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

keytool would be at: keytool将位于:

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.您还可以了解更多关于导出您的应用程序并准备好在那里发布的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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