How to get the SHA1 key in Flutter using gradlew signingReport in 2025 Step-by-Step Guide

To get the SHA1 key in Flutter using gradlew signingReport, follow these steps:

How to get the SHA1 key in Flutter ?

  1. Open your Flutter project in Android Studio or VS Code.
  2. Open the terminal and navigate to the android directory of your Flutter project by running the following command:
cd <your_flutter_project>/android
  1. Run the following command to generate the SHA1 key:
./gradlew signingReport

This will generate a list of signing reports, which includes the SHA1 key, for all the variants of your app. Look for the report that corresponds to the variant that you are using (usually debug), and copy the SHA1 key.

Here’s an example of what the output of the command might look like:

> Task :app:signingReport
Variant: debugAndroidTest
Config: debug
Store: /Users/username/.android/debug.keystore
Alias: AndroidDebugKey
MD5: 12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF
SHA1: 12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF:12:34:56:78:90
SHA-256: 12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF:12:34:56:78:90
Valid until: Wednesday, April 10, 2023

In this example, the SHA1 key is 12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF:12:34:56:78:90.

Note: If you are using Windows, replace ./gradlew with gradlew.bat in the command.

if you want to generate SHA1 key from any string then use crypto package.

import 'dart:convert';
import 'package:crypto/crypto.dart';

void main() {
  String input = "Your Input String"; // Replace with your input string
  var bytes = utf8.encode(input); // Convert the input string to bytes
  var sha1 = sha1.convert(bytes); // Generate the SHA1 hash
  var sha1String = sha1.toString(); // Convert the hash to a string
  print(sha1String); // Print the SHA1 hash
}

Replace "Your Input String" with the input string for which you want to generate the SHA1 key.

When you run the code, it will print the SHA1 hash of the input string. You can then use this SHA1 key for your desired purpose.

Note: The crypto package is not included in Flutter by default. You will need to add it to your pubspec.yaml file and run flutter pub get to download and install it.

FAQ

What is the SHA1 key in Flutter, and why is it needed?

The SHA1 key is a unique cryptographic fingerprint used to verify your app’s identity, especially when integrating services like Firebase, Google Sign-In, or Maps. It ensures secure communication between your Flutter app and external APIs.

How do I generate a SHA1 key using gradlew signingReport?

You can open your terminal, navigate to your Flutter project’s android/ folder, and run:

Where should I add the SHA1 key in Firebase?

Go to your Firebase Console → Project Settings → Android App → Add SHA-1. After that, download and replace the google-services.json in your Flutter project.

What’s the difference between SHA1 and SHA256?

SHA1 is commonly required for Firebase Authentication and Google services.
SHA256 is used for enhanced security and may be needed for Play App Signing or newer APIs.

Do I need to add both debug and release SHA keys?

Yes. Use:
debug SHA for local development (from signingReport)
release SHA for production (only if you use a release keystore)

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More