Skip to main content

How to generate the SHA from Android Studio

  1. Create a file in android folder of your project name key.properties if not exists.

  2. Add properties and it's value below

       storePassword=<Your JKS password>
    keyPassword=<Your JKS Key Password>
    keyAlias=<You JKS Key Alias>
    storeFile=<Your jks file location path>
  3. Add following line to your Android/app/build.gradle file above the all android block (Check if this line already exist or not)

       def keystoreProperties = new Properties()
    def keystorePropertiesFile = rootProject.file('key.properties')
    if (keystorePropertiesFile.exists())
    {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
    }
  4. Now in app:build.gradle android block check for below lines if not exist Add into your Android/app/build.gradle

       signingConfigs {
    release {
    keyAlias keystoreProperties['keyAlias']
    keyPassword keystoreProperties['keyPassword']
    storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
    storePassword keystoreProperties['storePassword']
    }
    }

    buildTypes {
    release {
    signingConfig signingConfigs.release
    }
    }
  5. Open your terminal and enter following command

       cd android
       ./gradlew signinReport

    Wait for a while it will generate your SHA Copy Both SHA1 and SHA256 for variant & config Debug and Release and add to Firebase