Android 中的“debug.keystore"和“release.keystore"有什么区别? [英] What is difference between 'debug.keystore' and 'release.keystore' in Android?

查看:26
本文介绍了Android 中的“debug.keystore"和“release.keystore"有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我在使用 Android Maps V2.我遇到了 debug.keystorerelease.keystore.它们之间有什么区别?为什么我们必须同时使用两者?

Recently, I was working with Android Maps V2. I came across debug.keystore and release.keystore. What is the difference between them? Why do we have to use both?

推荐答案

Android 构建过程对您的应用程序进行不同的签名,具体取决于您用于构建应用程序的构建模式.

The Android build process signs your application differently depending on which build mode you use to build your application.

有两种构建模式:调试模式发布模式.

您在开发和测试应用程序时使用调试模式.

You use debug mode when you are developing and testing your application.

当您想要构建应用的发布版本以将其直接分发给用户或在应用市场(例如 Google Play)上发布时,您可以使用发布模式.

You use release mode when you want to build a release version of your application that you can distribute directly to users or publish on an application marketplace such as Google Play.

当您在调试模式下构建时,Android SDK 构建工具使用 Keytool 实用程序(包含在 JDK 中)来创建调试密钥.因为 SDK 构建工具创建了调试密钥,所以它们知道调试密钥的别名和密码.每次在调试模式下编译应用程序时,构建工具都会使用调试密钥和 Jarsigner 实用程序(也包含在 JDK 中)来签署应用程序的 .apk 文件.因为别名和密码是 SDK 构建工具已知的,所以工具不需要在您每次编译时提示您输入调试密钥的别名和密码.

When you build in debug mode the Android SDK build tools use the Keytool utility (included in the JDK) to create a debug key. Because the SDK build tools created the debug key, they know the debug key's alias and password. Each time you compile your application in debug mode, the build tools use the debug key along with the Jarsigner utility (also included in the JDK) to sign your application's .apk file. Because the alias and password are known to the SDK build tools, the tools don't need to prompt you for the debug key's alias and password each time you compile.

当您在发布模式下构建时,您使用自己的私钥来签署您的应用程序.如果您没有私钥,可以使用 Keytool 实用程序为您创建一个.在发布模式下编译应用程序时,构建工具会使用您的私钥和 Jarsigner 实用程序对应用程序的 .apk 文件进行签名.由于您使用的证书和私钥是您自己的,因此您必须提供密钥库和密钥别名的密码.

When you build in release mode you use your own private key to sign your application. If you don't have a private key, you can use the Keytool utility to create one for you. When you compile your application in release mode, the build tools use your private key along with the Jarsigner utility to sign your application's .apk file. Because the certificate and private key you use are your own, you must provide the password for the keystore and key alias.

当您使用带有 ADT 插件的 Eclipse 运行或调试应用程序时,调试签名过程会自动发生.当您使用带有调试选项的 Ant 构建脚本时,调试签名也会自动发生.您可以使用 Eclipse 导出向导或通过修改 Ant 构建脚本并使用发布选项进行构建来自动执行发布签名过程.

The debug signing process happens automatically when you run or debug your application using Eclipse with the ADT plugin. Debug signing also happens automatically when you use the Ant build script with the debug option. You can automate the release signing process by using the Eclipse Export Wizard or by modifying the Ant build script and building with the release option.

编辑

有关使用 android studio 签署 android 应用程序的信息,请参见此处

For signing android app with android studio see here

http://developer.android.com/tools/publishing/app-signing.html#releasemode

这篇关于Android 中的“debug.keystore"和“release.keystore"有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆