Android 如何为 Google Play 生成“密钥库”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11446121/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:27:13  来源:igfitidea点击:

How do I generate a "Keystore" for Google Play?

androidgoogle-playkeytoolandroid-keystore

提问by Questioner

I am trying to figure out the Byzantine process for uploading an app to Google Play.

我试图找出将应用程序上传到 Google Play 的拜占庭流程。

I'm using Phonegap's Applaud system for generating my app, and in order for me to create a "release build", I need to have generated a "Keystore".

我正在使用 Phonegap 的 Applaud 系统来生成我的应用程序,为了创建“发布版本”,我需要生成一个“密钥库”。

However, when I look at Google's own Publishing Checklist, there is nothing on it about a "Keystore".

但是,当我查看 Google 自己的Publishing Checklist 时,没有任何关于“密钥库”的内容。

I found this answer here on Stack Overflowfor generating a "Keystore", which theoretically should work on Ubuntu, which is what I'm using:

在 Stack Overflow 上找到了这个答案,用于生成“密钥库”,理论上应该适用于 Ubuntu,这就是我正在使用的:

keytool –genkey –v –keystore just2try.keystore –alias someKindOfName –keyalg RSA –validity 10000

First, what exactly should I be putting in where it says someKindOfName? The name of my app?

首先,我到底应该在它说的地方放什么someKindOfName?我的应用程序的名称?

In any case, when I run it, I get this response:

无论如何,当我运行它时,我得到以下响应:

keytool error: java.lang.RuntimeException: Usage error, –genkey is not a legal command

I Googled for solutions, but the only ones I found were for Windows.

我在谷歌上搜索了解决方案,但我找到的唯一解决方案是针对 Windows 的。

Can someone provide, or point to, a slightly more user friendly step by step guide for generating this "Keystore" thing I'm supposed to have? One with working comands for Ubuntu/Linux?

有人可以提供或指出一个稍微对用户更友好的分步指南来生成我应该拥有的这个“密钥库”吗?有一个适用于 Ubuntu/Linux 的工作命令吗?

回答by Romin

The command that you have provided for generating the keystore is correct i.e.

您提供的用于生成密钥库的命令是正确的,即

keytool -v -genkey -v -keystore just2try.keystore -alias someKindOfName -keyalg RSA -validity 10000

keytool -v -genkey -v -keystore just2try.keystore -alias someKindOfName -keyalg RSA -validity 10000

Please do the following. Do not copy it, since I believe the error that you are seeing it related to some special characters. Type the whole thing as is in your command prompt or shell.

请执行以下操作。不要复制它,因为我相信您看到的错误与某些特殊字符有关。在命令提示符或 shell 中按原样键入整个内容。

The just2try.keystoreis any name for your Java based keystore file. You can select any name as you have done or give it some name that you know you can identify the keystore file with.

just2try.keystore是你的基于Java的密钥库文件中的任何名称。您可以选择任何您已经完成的名称,或者给它一个您知道可以用来识别密钥库文件的名称。

Finally, keep in mind that a keystore is like a collection of keys, where each one is identified by a name or an alias. So you should pick an alias that you know identifies the specific key. Examples : myorgkey, myandroidappkey, etc.

最后,请记住,密钥库就像一组密钥,其中每个密钥都由名称或别名标识。所以你应该选择一个你知道标识特定键的别名。示例:myorgkey、myandroidappkey 等。

In case, you forget what alias' are present in the keystore, you can always use the -list command to see all the keys in the keystore. Example : keytool -v -list -keystore just2try.keystore

如果您忘记了密钥库中的别名,您可以随时使用 -list 命令查看密钥库中的所有密钥。例子 :keytool -v -list -keystore just2try.keystore