arslan haktic
arslan haktic

Reputation: 4548

Get SHA1 fingerprint certificate in Android Studio for Google Maps

I want to get the SHA1 key from Android Studio on a Mac. From Eclipse it's simple, but I can't get this in Android Studio.

I have checked similar questions but didn't get any way to get that in MAC.

The SHA1 is different for signed and unsigned APK. Please mention the methods to get for both.

Upvotes: 79

Views: 142864

Answers (11)

karamjeet singh
karamjeet singh

Reputation: 9

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

for get SHA1 and SHA256 key in the mac terminel

Upvotes: -1

arslan haktic
arslan haktic

Reputation: 4548

I got my Answer, it was quite simple. Open Terminal, Type command:

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

Press Enter: You will get the following info, and SHA1 can be seen there.

.....

Certificate fingerprints:

 MD5:  79:F5:59:................FE:09:D1:EC

 SHA1: 33:57:0A:C9:..................:91:47:14:CD

 SHA256: 39:AA:23:88:D6:...................33:DF:61:24:CB:17:47:EA:39:94:99

.......

Upvotes: 240

sebastian
sebastian

Reputation: 2890

  1. Go to your key directory / Folder.
  2. Use following command in the terminal: keytool -list -v -keystore <yourKeyFileName.withExtension> -alias <yourKeyAlias>.
  3. Enter Key Password entered at time of key creations.

yourKeyAlias had given at time of creation of your key.

Upvotes: 11

Tigress_ Tamannah
Tigress_ Tamannah

Reputation: 51

Type this is the Terminal
keytool -list -v -keystore ~/.android/debug.keystore

It will ask you to enter the password
enter 'android'

Then you would get the details like the SHA1.

Upvotes: 5

Sneha Patel
Sneha Patel

Reputation: 393

Follow the below steps to get SHA1 fingerprint Certificate in Android Studio in 2.2v.

Open Android Studio Open your Project Click on Gradle (From Right Side Panel, you will see Gradle Bar)

Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)

Click on Your Project (Your Project Name form List (root))

Click on Tasks

Click on Android

Double Click on signing-report (You will get SHA1 and MD5 in Run Bar) Then click this button: enter image description here (top left of the error log) and you will get your SHA1 key.

Upvotes: 10

Quick learner
Quick learner

Reputation: 11477

FOR PRODUCTION BUILD / LIVE BUILD sha key follow these steps

Step 1 ) Add release details in gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 24
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "app.devdeeds.com.yourapplication"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
//Signing configurations for build variants "release"
    signingConfigs {
        release {
            storeFile file("F:/Development/myapp.jks")
            storePassword "231232das"
            keyAlias "myapp_rel"
            keyPassword "dasd333_das"
        }
    }
    buildTypes {
    //link above defined configuration to "release" build type
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
}

Step 2) open gradle menu from right menu bar and then app > android > signingReport

enter image description here

Step 3) Click on signingReport and see the magic

enter image description here

Upvotes: 1

Uzair
Uzair

Reputation: 337

After clicking signingReport You will get SHA-1 finger certificate for your application

After clicking signingReport You will get SHA-1 finger certificate for your application

I am here if you need any other help

Upvotes: 1

Poras Bhardwaj
Poras Bhardwaj

Reputation: 1123

All above answers are correct.

But,Easiest and Faster way is below:

  1. Open Android Studio

  2. Open Your Project

  3. Click on Gradle (From Right Side Panel, you will see Gradle Bar)

  4. Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)

  5. Click on Your Project Name like MyProject(root)

  6. Click on Tasks

  7. Click on android

  8. Double Click on signingReport

  9. Wait for few seconds and you will get SHA1 and MD5 in Console Bar

enter image description here

If you are adding a MapActivity in your project than see this answer for SHA1. How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?

Upvotes: 29

Jignesh Goyani
Jignesh Goyani

Reputation: 1020

Very easy and simply finding the SHA1 key for certificate in only android studio.
You can use below steps:

A.Open Android Studio
B.Open Your Project
C.Click on Gradle (From Right Side Panel, you will see Gradle Bar)
D.Click on Refresh (Click on Refresh from Gradle Bar, you will see List Gradle scripts of your Project)
E.Click on Your Project (Your Project Name form List (root))
F.Click on Tasks
G.Click on android
H.Double Click on signingReport (You will get SHA1 and MD5 in Run Bar)

OR

1.Click on your package and choose New -> Google -> Google Maps Activity
2.Android Studio redirect you to google_maps_api.xml

enter image description here

Upvotes: 51

Abdul Rahman Majeed
Abdul Rahman Majeed

Reputation: 1135

There is no way in Android Studio like Eclipse Windows -> Preferences -> Android -> Build.

Android Studio signs your app in debug mode automatically when you run or debug your project from the IDE.

You may get using the following Command!!

keytool -list -v -keystore  ~/.android/debug.keystore

Upvotes: 5

Rod_Algonquin
Rod_Algonquin

Reputation: 26198

The other way to get the SHA1 fingerprint instead of inputting a keytool command is to create dummy project and select the Google Map Activity in the Add an activity module and after the project is created you then open the values->google_maps_api.xml in that xml you'll see the SHA1 fingerprint of your android studio.

Upvotes: 7

Related Questions