获取SHA-1指纹的方法和获取指纹的方法一样吗?之前,我正在运行这个命令:

我不清楚我得到的结果是不是SHA-1指纹。有人能解释一下吗?


当前回答

//获取SHA1的最简单方法

//添加以下命令到您的终端并按enter

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android 

其他回答

如果你使用android studio使用简单的步骤:

运行你的项目 点击Gradle菜单 展开Gradle任务树 点击android-> signingReport

如果没有任何显示(android studio 2.2),那么

从运行栏点击切换任务执行/文本模式

对我来说,这是一个循序渐进的过程。

首先运行应用程序,然后按照以下步骤(也显示在截图)

点击签署报告 打开gradle控制台对话框 它会显示你的SHA-1证书编号

如果你使用React Native,调试。Keystore在android/app中,但可能不在~/.android中。

设置调试。Keystore路径如下:

keytool -list -v -keystore {PROJECT_ROOT}/android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android

控制台将打印如下内容:

Alias name: androiddebugkey
Creation date: Jan 1, 2014
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, OU=Android, O=Unknown, L=Unknown, ST=Unknown, C=US
Issuer: CN=Android Debug, OU=Android, O=Unknown, L=Unknown, ST=Unknown, C=US
Serial number: 2==Serial Number==2
Valid from: Wed Jan 01 06:35:04 CST 2014 until: Wed May 01 06:35:04 CST 2052
Certificate fingerprints:
     SHA1: 5E:=========== SHA1 SIGNING KEY ===========:25
     SHA256: FA:============ SHA 256 ===================9C
Signature algorithm name: SHA1withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3

[![更改构建变量,然后您可以看到应用程序的运行,这将导致错误

你必须找到释放密钥的SHA1代码,并在开发人员控制台输入它。(对我来说,开发人员控制台是firebase,有些人可能使用不同的服务)找到SHA1代码。简单的方法是

Go to Build --- Select Build Variant -- On the left Side Select "Release" as build variant -- now go to module settings ( or try to run project , android studio will tell you about a error and click fix error button) --- Select Signing tab --- add your release key and passwords -- now goto build types -- select release -- on signing config select your release key config -- now run your project -- now run your signing report --- you can find SHA1 under release build -- enter that sha1 code on your developer console

我使用的是Ubuntu 12.0.4,我已经通过这种方式在命令提示符上获得了发布密钥存储的证书指纹 在生成keystore文件后,你可以使用这个密钥发布应用程序,如果你在你的应用程序中使用谷歌映射,这样可以在发布后在应用程序中正确显示映射,我在下面的命令提示符中得到了结果

administrator@user:~$ keytool -list -v -keystore /home/administrator/mykeystore/mykeystore.jks -alias myprojectalias Enter keystore password: ****** Alias name: myprojectalias Creation date: 22 Apr, 2014 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate[1]: Owner: CN=xyz, OU= xyz, O= xyz, L= xyz, ST= xyz, C=91 Issuer: CN= xyz, OU= xyz, O= xyz, L= xyz, ST= xyz, C=91 Serial number: 7c4rwrfdff Valid from: Fri Apr 22 11:59:55 IST 2014 until: Tue Apr 14 11:59:55 IST 2039 Certificate fingerprints: MD5: 95:A2:4B:3A:0D:40:23:FF:F1:F3:45:26:F5:1C:CE:86 SHA1: DF:95:Y6:7B:D7:0C:CD:25:04:11:54:FA:40:A7:1F:C5:44:94:AB:90 SHA276: 00:7E:B6:EC:55:2D:C6:C9:43:EE:8A:42:BB:5E:14:BB:33:FD:A4:A8:B8:5C:2A:DE:65:5C:A3:FE:C0:14:A8:02 Signature algorithm name: SHA276withRSA Version: 2 Extensions: ObjectId: 2.6.28.14 Criticality=false SubjectKeyIdentifier [ KeyIdentifier [ 0000: 1E A1 57 F2 81 AR 57 D6 AC 54 65 89 E0 77 65 D9 ..W...Q..Tb..W6. 0010: 3B 38 9C E1

在Windows平台上,我们可以使用下面的方法获取调试模式的密钥库

C:\Program Files\Java\jdk1.8.0_102\bin>keytool -l .android\debug.keystore -alias androiddebugkey -s id Alias name: androiddebugkey Creation date: Oct 21, 2016 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate[1]: Owner: C=US, O=Android, CN=Android Debug Issuer: C=US, O=Android, CN=Android Debug Serial number: 1 Valid from: Fri Oct 21 00:50:00 IST 2016 until: S Certificate fingerprints: MD5: 86:E3:2E:D7:0E:22:D6:23:2E:D8:E7:E SHA1: B4:6F:BE:13:AA:FF:E5:AB:58:20:A9:B SHA256: 15:88:E2:1E:42:6F:61:72:02:44:68 56:49:4C:32:D6:17:34:A6:7B:A5:A6 Signature algorithm name: SHA1withRSA