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

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


当前回答

首先要知道你是在调试模式还是发布模式。有两种构建模式:调试模式和发布模式。在开发和测试应用程序时使用调试模式。当你想要构建一个可以直接发布给用户或在谷歌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 <——这个链接几乎解释了你需要知道的一切。

其他回答

如果你不想或不能使用Android Studio,你可以使用create-android-keystore NPM工具:

$ create-android-keystore quick

这会在当前目录中生成一个新生成的密钥存储库。

更多信息:https://www.npmjs.com/package/create-android-keystore

我疯狂地寻找如何在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 -密钥和证书管理工具。

本教程:

“sign-your-android-applications-for.html”

存档: https://web.archive.org/web/20181002011446/http://techdroid.kbeanie.com/2010/02/sign-your-android-applications-for.html

在我第一次创建密钥存储库时非常有用。这很简单,但developer.android.com上的说明有点太简短了。

我不确定的部分是保存在哪里以及给keystore文件起什么名字。

我认为把它放在哪里并不重要,只要确保它的安全,并保留一些备份。 我只是把它放到我的应用程序目录里

将文件命名为“something”。密钥存储库”,其中的东西可以是您想要的任何东西。我使用了app_name。Keystore,其中app_name是应用程序的名称。

下一个问题是如何命名别名。这似乎无关紧要,所以我再次使用app_name。请保持与以前相同的密码。填写剩下的字段就完成了。

我想建议自动方式与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工作室导出一个项目?