Android Studio 4.2.1中如何获取SHA-1指纹证书?升级后找不到Gradle签名报告该怎么办?
Hey there, let's walk through how to get your SHA-1 and SHA-256 fingerprints in Android Studio 4.2.1, especially addressing the issue of missing signing reports after upgrading. Here are a few reliable methods:
方法一:通过Gradle面板调出签名报告
If you can't find the signing report in the Gradle panel, it's likely just a navigation tweak in 4.2.1. Try these steps:
- First, ensure the Gradle tool window is visible. If not, go to the top menu bar and select
View > Tool Windows > Gradleto bring it up (it's usually pinned to the right side of the IDE). - Expand your project name in the Gradle panel, then drill down into
Tasks > android. - Look for the
signingReporttask under the android folder—double-click it to run. - Once execution finishes, check the Run tab at the bottom of the IDE. You'll see the full output with SHA-1, SHA-256, and other fingerprints for all your build variants (debug, release, etc.).
方法二:直接用Terminal执行Gradle命令
If the Gradle panel route isn't working for you, using the terminal is a surefire alternative:
- Open the Terminal panel at the bottom of Android Studio.
- Run the appropriate command based on your OS:
- For Windows:
gradlew signingReport - For Mac/Linux:
./gradlew signingReport
- For Windows:
- Hit enter, wait for the command to complete, and you'll see all your signing fingerprints printed directly in the terminal.
方法三:从密钥库文件直接提取(适合自定义签名)
If you're using a custom keystore for release builds (or even want to check the default debug keystore), you can use the keytool command directly:
针对默认Debug密钥库
Android Studio creates a default debug keystore automatically. Its path varies by OS:
- Windows:
C:\Users\[你的用户名]\.android\debug.keystore - Mac:
/Users/[你的用户名]/.android/debug.keystore - Linux:
/home/[你的用户名]/.android/debug.keystore
运行以下命令(替换路径为你的实际路径):
keytool -list -v -keystore /path/to/debug.keystore -alias androiddebugkey -storepass android -keypass android
默认别名是androiddebugkey,密钥库和别名的密码都是android。
针对自定义Release密钥库
替换占位符为你的密钥库详情:
keytool -list -v -keystore /path/to/your-release-keystore.jks -alias your-key-alias -storepass your-keystore-password -keypass your-key-password
执行后会输出你自定义签名密钥的所有指纹信息。
内容的提问来源于stack exchange,提问作者Leonard




