Android Studio中获取sha1证书指纹数据的方法

ALDRIDGE 2015-02-28

Android Studio 获取sha1

开发软件的时候要使用到百度地图API,开发申请KEY的时候需要开发者提供SHA1证书指纹数据,以前我用的Eclipse在export软件的时候,最后一步会有sha1,但是Android Studio很久也没找到,然后求助google,在stack over flow上找到答案:

Go to your java bin directory via the cmd:
C:\Program Files\Java\jdk1.7.0_71\bin>
Now type in the below command in your cmd:
keytool
-list -v -keystore c:\users\your_user_name\.android\debug.keystore
-alias
androiddebugkey -storepass android -keypass android
example:

keytool
-list -v -keystore c:\users\James\.android\debug.keystore -alias
androiddebugkey -storepass android -keypass android
and you will get SHA1

于是我按照提示这样这样就好了(我的系统是linux系统,所以操作和上面的答案些许不同,但是基本相同):

1.打开Terminal,输入keytool -list -v -keystore ~/larsoncode/[email protected]

注意:~/larsoncode/[email protected] 是你key的路径。

然后会提示你输入key密码Enter keystore password:

显示结果:

Keystore type: JKS

Keystore provider: SUN

Your keystore contains 1 entry

Alias name: larson

Creation date: 21-Oct-2014

Entry type: PrivateKeyEntry

Certificate chain length: 1

Certificate[1]:

Owner: C=CN

Issuer: C=CN

Serial number: 54460fd4

Valid from: Tue Oct 21 15:48:36 HKT 2014 until: Sun Oct 14 15:48:36 HKT 2040

Certificate fingerprints:

MD5: xxxxxxxxxxx

SHA1: xxxxxxxxxxx

SHA256: xxxxxxxxxxx

Signature algorithm name: SHA1withRSA

Version: 3

*******************************************

*******************************************

相关推荐

手机开发 / 0评论 2016-09-29