为android创建密钥存储库的步骤是什么?
我需要在我的应用程序中使用谷歌地图,我不知道我错过了什么步骤。 请提供给我具体的详细步骤(我看指南没看懂)
为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
其他回答
从命令行创建keystore文件:
Open Command line: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved // (if you want to store keystore file at C:/ open command line with RUN AS ADMINISTRATOR) C:\Windows\system32> keytool -genkey -v -keystore [your keystore file path]{C:/index.keystore} -alias [your_alias_name]{index} -keyalg RSA -keysize 2048 -validity 10000[in days] Enter > It will prompt you for password > enter password (it will be invisible) Enter keystore password: Re-enter new password: Enter > It will ask your detail. What is your first and last name? [Unknown]: {AB} // [Your Name / Name of Signer] What is the name of your organizational unit? [Unknown]: {Self} // [Your Unit Name] What is the name of your organization? [Unknown]: {Self} // [Your Organization Name] What is the name of your City or Locality? [Unknown]: {INDORE} // [Your City Name] What is the name of your State or Province? [Unknown]: {MP} //[Your State] What is the two-letter country code for this unit? [Unknown]: 91 Enter > Enter Y Is CN=AB, OU=Self, O=Self, L=INDORE, ST=MP, C=91 correct? [no]: Y Enter > Enter password again. Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days for: CN=AB, OU=Self, O=Self, L=INDORE, ST=MP, C=91 Enter key password for <index> (RETURN if same as keystore password): Re-enter new password:
[存储C:/index.]密钥存储库)
你的任务完成了!!
在Eclipse中导出:
导出您的android包到.apk与您创建的keystore文件
右键单击要导出的包并选择导出 选择“Export Android Application > Next” 下一个 选择Use Existing Keystore > Browse .keystore file > enter password >下一步 选择Alias > enter password >下一步 浏览APK Destination > Finish
在Android Studio中:
创建密钥存储库[.keystore/。在工作室…
点击Build (ALT+B) > Generate Signed APK… 点击Create new..(ALT+C) Browse Key store path (SHIFT+ENTER) > Select path >输入name > OK 填写关于.jks/keystore文件的详细信息 下一个 您的文件 输入工作室主密码(如果不知道可以重置)> OK 选择*目标文件夹* >生成类型 发布:用于在应用商店发布 调试:用于调试应用程序 单击Finish
完成了! !
基于@EliuX的回答,最新的工具与应用程序包兼容
echo y | keytool -genkey -keystore ./android.jks -dname "n=Mark Jones, ou=JavaSoft, o=Sun, c=US" -alias android -keypass android -storepass android -keyalg RSA -keysize 2048 -validity 2000
为了你的build.gradle
signingConfigs {
debug {
storeFile file('android.jks')
keyAlias 'android'
keyPassword 'android'
storePassword 'android'
}
}
您可以通过导出签名APK来创建密钥存储库。当您尝试导出/构建一个签名的APK时,它将要求一个密钥存储库。
您可以选择现有的密钥存储库,也可以通过单击create new密钥存储库轻松创建一个新的密钥存储库
这里有一个非常有用的链接,详细解释了如何创建密钥存储库并生成签名APK
这个链接解释了如何在Android Studio中做到这一点,但如果我记得,它在Eclipse中非常相似
小心
生成密钥存储库后,请将其保存在安全的地方,因为您将需要它来重新生成一个新的签名APK。
我如何在Android工作室导出一个项目?
我按照本指南创建了调试密钥库。
命令如下:
keytool -genkeypair -alias androiddebugkey -keypass android -keystore debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999
我疯狂地寻找如何在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 -密钥和证书管理工具。