如何为我的 Android Market APK 创建证书?

发布于 2024-09-28 13:57:35 字数 819 浏览 3 评论 0原文

我想将我的第一个 APK/应用程序上传到 Android Market,但我收到了此错误(顺便说一下,在 stackoverflow 中搜索时并没有引导我找到正确的链接)。

市场不接受使用调试证书签名的应用程序。创建有效期至少 50 年的新证书。 Market 要求用于签署 apk 的证书至少在 2033 年 10 月 22 日之前有效。创建一个新证书。

尽管事实证明 这个问题是类似的,那家伙只是说“哦,你提醒我该怎么做”而没有实际解释。我查看了“答案”中提到的网站,但这是我的问题:

  • 我不知道我的 keytool 工具在哪里。 Android 网站 相当模糊;我在 ..\android-sdk-windows\tools 目录中没有看到任何类型的“keytool”。
  • 我想我以前已经这样做过,但我希望我有一组步骤,例如“打开命令提示符,导航到 keytool 所在的目录,输入命令“xyz -flagsforxyz”,然后指向Eclipse 中“导出发布 apk”选项的密钥库”...或类似的东西。

我希望你能看出我已经尝试了一些事情!我可能只是忽略了一些简单的事情——所以是时候将这些步骤记录在 stackoverflow 中了!感谢您的帮助。

I want to upload my first APK/app to the Android Market, but I got this error (which did not lead me to the correct link when searched for in stackoverflow, by the way).

Market does not accept apks signed with the debug certificate. Create a new certificate that is valid for at least 50 years.
Market requires that the certificate used to sign the apk be valid until at least October 22, 2033. Create a new certificate.

Though it turns out this question is similar, the guy just says "Oh, you reminded me of how to do it" without actually explaining. I've looked at the website referred to in the "answer", but here's my problem:

  • I don't know where my keytool tool is. The Android site is pretty vague; I don't see "keytool" of any sort in my ..\android-sdk-windows\tools directory.
  • I think I've done this before, but I wish I had a set of steps that is like "Open up a command prompt, navigate to the directory where keytool is, enter in command 'xyz -flagsforxyz', and then point to the keystore from the 'export release apk' option in Eclipse"... or something similar.

I hope you can tell that I've tried a few things already! I might just be overlooking something simple -- so it's time for the steps to be recorded in stackoverflow! Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浴红衣 2024-10-05 13:57:35

如果您使用 Eclipse 进行开发,只需右键单击您的项目并单击导出。现在选择 Android,然后选择导出 Android 应用程序。在下一步中确认您要导出的项目。然后单击下一步,现在您应该能够选择创建新的密钥库。现在填写必填字段,您应该能够签署您的应用程序。请务必备份密钥库文件并记住您的密码。丢失此信息将导致您无法更新您的应用程序。

如果您使用终端创建密钥库并且安装了 Java SDK,则 /usr/bin 中应该有一个名为 keytool 的程序(在基于 UNIX 的系统上)。在 Windows 上,SDK 还应该附带 keytool,但安装位置可能会有所不同,如果 keytool 不在您的路径中,则在您的计算机上搜索 keytool.exe。使用此工具,您应该能够通过以下方式创建密钥:

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000

请记住,一旦您丢失证书或证书过期,您将无法签署您的应用程序。确保到期日期是未来很长一段时间。

If you are using Eclipse for Development just right click on your project and click export. Now choose Android and then Export Android Application. In the next step confirm the project that you want to export. Then click next and now you should be able to select create new keystore. Now fill in the required fields and your should be able to sign your app. Be sure to make a backup of the keystore file and remember your password. Losing this will make it impossible to update your application.

If you are using the terminal to create a keystore and you have Java SDK installed there should be a program called keytool in /usr/bin (on a unix based system). On Windows the SDK should also come with the keytool but the install location may be different search for keytool.exe on your computer if keytool is not in your path already. With this tool you should be able to create a key in the following way:

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000

Remember that once you lose your Certificate or it expires you will not be able to sign your application. Make sure that the expiration date is a long long time in the future.

勿忘初心 2024-10-05 13:57:35

是的,janusz 已经很好地解释了这一点,但我想在将应用程序推向市场之前告诉一些更多步骤。
因此第一步是使用 jarsigner 对应用程序进行签名

jarsigner -verbose -keystore pkg_name apk_file_name key_name

,第二步是使用 zipalign 以确保您不会丢失任何空间。

zipalign -v 4 apk_file_name zipped_apk_file_name(newfile)

它一定会帮助您启动您的应用程序。

Yes, janusz has explained it very nicely but I would like to tell some more steps before lunching App to market.
so the first step is to sign the App using jarsigner

jarsigner -verbose -keystore pkg_name apk_file_name key_name

and the second step is to use zipalign to make sure that you are not losing any space.

zipalign -v 4 apk_file_name zipped_apk_file_name(newfile)

it will surely help you to launch your App.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文