为android创建密钥存储库的步骤是什么?

我需要在我的应用程序中使用谷歌地图,我不知道我错过了什么步骤。 请提供给我具体的详细步骤(我看指南没看懂)


当前回答

在Android Studio中签名应用

要在Android Studio的发布模式下签署应用,请遵循以下步骤:

1-在菜单栏上,单击“Build > Generate Signed APK”。


2-在Generate Signed APK Wizard窗口中,单击Create new创建一个新的密钥库。 如果您已经有一个密钥存储库,请转到步骤4。


3-在“New Key Store”窗口中,提供如图所示的所需信息 你的密钥应该至少有效25年,所以你可以在应用的生命周期内使用相同的密钥签署应用更新。

4—在“Generate Signed APK Wizard”窗口中,选择密钥库和私钥,并输入两者的密码。然后单击“下一步”。 5-在下一个窗口中,为签名的APK选择一个目的地,然后单击Finish。

参考

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

其他回答

首先要知道你是在调试模式还是发布模式。有两种构建模式:调试模式和发布模式。在开发和测试应用程序时使用调试模式。当你想要构建一个可以直接发布给用户或在谷歌Play等应用市场上发布的应用版本时,你可以使用发布模式。”

如果您处于调试模式,请执行以下操作… A.打开终端和类型:

keytool -exportcert -alias androiddebugkey -keystore path_to_debug_or_production_keystore -list -v

注意:对于Eclipse,调试密钥库通常位于~/.android/debug.keystore…

B.当提示输入密码时,只需输入“android”…

C.如果您处于释放模式,请按照…

http://developer.android.com/tools/publishing/app-signing.html <——这个链接几乎解释了你需要知道的一切。

我疯狂地寻找如何在shell中使用单行命令生成.keystore,以便从另一个应用程序运行它。是这样的:

echo y | keytool -genkeypair -dname "cn=Mark Jones, ou=JavaSoft, o=Sun, c=US" -alias business -keypass kpi135 -keystore /working/android.keystore -storepass ab987c -validity 20000

dname is a unique identifier for the application in the .keystore cn the full name of the person or organization that generates the .keystore ou Organizational Unit that creates the project, its a subdivision of the Organization that creates it. Ex. android.google.com o Organization owner of the whole project. Its a higher scope than ou. Ex.: google.com c The country short code. Ex: For United States is "US" alias Identifier of the app as an single entity inside the .keystore (it can have many) keypass Password for protecting that specific alias. keystore Path where the .keystore file shall be created (the standard extension is actually .ks) storepass Password for protecting the whole .keystore content. validity Amout of days the app will be valid with this .keystore

它对我来说工作得很好,它不要求控制台中的任何其他东西,只是创建文件。有关更多信息,请参阅keytool -密钥和证书管理工具。

我想建议自动方式与gradle仅

**在最后一个命令中定义至少一个额外的keystore参数,例如country '-dname', 'c=RU' **

apply plugin: 'com.android.application'

// define here sign properties
def sPassword = 'storePassword_here'
def kAlias = 'keyAlias_here'
def kPassword = 'keyPassword_here'

android {
    ...
    signingConfigs {
        release {
            storeFile file("keystore/release.jks")
            storePassword sPassword
            keyAlias kAlias
            keyPassword kPassword
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.release
        }
        release {
            shrinkResources true
            minifyEnabled true
            useProguard true
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    ...
}

...

task generateKeystore() {
    exec {
        workingDir projectDir
        commandLine 'mkdir', '-p', 'keystore'
    }
    exec {
        workingDir projectDir
        commandLine 'rm', '-f', 'keystore/release.jks'
    }
    exec {
        workingDir projectDir
        commandLine 'keytool', '-genkey', '-noprompt', '-keystore', 'keystore/release.jks',
            '-alias', kAlias, '-storepass', sPassword, '-keypass', kPassword, '-dname', 'c=RU',
            '-keyalg', 'RSA', '-keysize', '2048', '-validity', '10000'
    }
}

project.afterEvaluate {
    preBuild.dependsOn generateKeystore
}

这将在项目同步和构建中生成密钥存储库

> Task :app:generateKeystore UP-TO-DATE
> Task :app:preBuild UP-TO-DATE

您可以通过导出签名APK来创建密钥存储库。当您尝试导出/构建一个签名的APK时,它将要求一个密钥存储库。

您可以选择现有的密钥存储库,也可以通过单击create new密钥存储库轻松创建一个新的密钥存储库

这里有一个非常有用的链接,详细解释了如何创建密钥存储库并生成签名APK

这个链接解释了如何在Android Studio中做到这一点,但如果我记得,它在Eclipse中非常相似

小心

生成密钥存储库后,请将其保存在安全的地方,因为您将需要它来重新生成一个新的签名APK。

我如何在Android工作室导出一个项目?

要回答标题中的问题,您可以使用任何标准JDK发行版附带的Java Keytool实用程序创建一个密钥存储库,可以位于%JAVA_HOME%\bin。在Windows上通常是C:\Program Files\Java\jre7\bin.

在Windows上,打开一个命令窗口并切换到该目录。在Linux类型的操作系统上,对终端执行同样的操作。然后运行:

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

Keytool提示您提供密钥库的密码,提供Distinguished Name字段,然后是密钥的密码。然后,它将密钥存储库生成为名为my-release-key的文件。您所在目录中的密钥存储库。密钥存储库和密钥由您输入的密码保护。密钥存储库包含一个密钥,有效期为10000天。alias_name是稍后将使用的名称,在为应用程序签名时引用此密钥存储库。

有关Keytool的更多信息,请参阅文档:http://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html

更多关于安卓应用程序签名的信息,请访问:http://developer.android.com/tools/publishing/app-signing.html