Obtaining the SHA-1 Fingerprint Certificate in Android Studio

Android Studio uses a debug keystore to sign applications during development. To use certain features like Google Maps, you need to obtain the SHA-1 fingerprint certificate from this keystore. Here’s how you can do it:

Method 1: Using the Gradle Signing Report

  1. Open your project in Android Studio.
  2. Click on the Gradle button on the right side of the IDE to open the Gradle panel.
  3. In the Gradle panel, click on the Refresh button to refresh the list of tasks.
  4. Expand the app module and navigate to Tasks > Android.
  5. Double-click on signingReport to generate the signing report.

The SHA-1 fingerprint certificate will be displayed in the Run console or the Gradle Console.

Method 2: Using the Google Maps Activity

  1. Open your project in Android Studio.
  2. Click on File > New > Google > Google Maps Activity to create a new Google Maps activity.
  3. Follow the prompts to create the activity.
  4. Android Studio will generate an google_maps_api.xml file containing the SHA-1 fingerprint certificate.

You can find the SHA-1 fingerprint certificate in this XML file, usually on line 10.

Method 3: Using the Keytool Command

If you prefer to use the command line, you can obtain the SHA-1 fingerprint certificate using the keytool command:

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

On Mac or Linux, use:

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

Make sure to navigate to the Java bin directory before running this command.

Tips and Variations

  • If you’re using Android Studio 4.2 or later, you may need to use the Execute Gradle Task terminal instead of the Run console.
  • To obtain the SHA-1 fingerprint certificate for a Flutter or React Native project, navigate to the android folder and run the gradlew signingreport command.
  • If you’ve previously registered your app with a different SHA-1 fingerprint certificate (e.g., from Eclipse), you can use the same API key in Android Studio.

By following these methods, you should be able to obtain the SHA-1 fingerprint certificate for your Android project in Android Studio.

Leave a Reply

Your email address will not be published. Required fields are marked *