我正在Google's tutorial关注如何设置OAuth 2.0。文档要求我在终端中使用以下命令找到调试证书指纹:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v
这不起作用,出现以下错误:
keytool error: java.lang.Exception: Only one command is allowed: both -exportcert and -list were specified.
在Mac上正确的命令是什么?
本教程中提供的命令(显然)适用于Windows,但不适用于Mac。但是,此功能在Mac上就像一个魅力:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
它已经在命令中添加了默认密码android
,从而避免了键入。我希望Google会修复该文档。
输出应类似于:
Alias name: androiddebugkey
Creation date: 23 Nov 2019
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: Sat Nov 23 14:57:45 CET 2019 until: Mon Nov 15 14:57:45 CET 2049
Certificate fingerprints:
SHA1: xxxxxx
SHA256: xxxxxx
Signature algorithm name: SHA1withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 1
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /Users/cornelius/.android/debug.keystore -destkeystore /Users/cornelius/.android/debug.keystore -deststoretype pkcs12".
信用:@JoeNCA https://stackoverflow.com/a/28350434/7483211