How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
2017-09-01 06:35
821 查看
How
to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
AskQuestion
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/10/d7d646f4d3cd91a472d13d866ea81ca3.png)
![](https://engine.adzerk.net/i.gif?e=eyJhdiI6NDE0LCJhdCI6NCwiYnQiOjAsImNtIjo0NzE0OTMsImNoIjoxMTc4LCJjayI6e30sImNyIjoxNjM4OTg1LCJkaSI6IjA3Y2MyZTk1ZDc2YjQ5MmFiZGJkY2RjOTMwODE1NjY1IiwiZG0iOjEsImZjIjoxOTQzNDM2LCJmbCI6MjE0MjMxMiwiaXAiOiIyMjMuMjIzLjE5Ni4xNzAiLCJrdyI6ImFuZHJvaWQsZ29vZ2xlLW1hcHMsYW5kcm9pZC1zdHVkaW8iLCJudyI6MjIsInBjIjowLCJlYyI6MCwicHIiOjE2MDQsInJ0IjoxLCJzYSI6IjMiLCJzYiI6ImktMDZjYTNmODA3NTc2YzU2MWMiLCJzcCI6MzA3OTYsInN0Ijo4Mjc3LCJ1ayI6InVlMS03OGJjMjcxMWNlOGY0N2NmOTIwZGQ0ZTdmZTQ2MjRhZSIsInpuIjo0MywidHMiOjE1MDQyMTgxNDY0OTEsImJmIjp0cnVlLCJwbiI6ImFkemVyazEwNDgxMjYzMDMiLCJmcSI6MH0&s=46bIe2iMS4c9u05Oqk4MF-ReXi0)
up vote284down votefavorite 172 | I have shifted myself from Eclipse to Android Studio. Now I am trying to work on my Map app. So I need my SHA-1 fingerprint certificate number. When I was using Eclipse it was right under Windows -> Preferences -> Android -> Build. But in Android Studio I couldn't find out any option like this so that I could find easily the fingerprint. I am using Windows. I have read from this link that: Android Studio signs your app in debug mode automatically when you run or debug your project from the IDE. So I tried to run this in command line after setting my Java bin path from this link and unfortunately couldn't find my fingerprint. It is saying that it is an illegal option. keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android Is there a way to find the SHA-1 fingerprint from Android Studio like it was very easy in Eclipse? As I am newbie in Android Studio, what is the full process to find it? Another thing I want to add is that I have my Eclipse generates the SHA-1 fingerprint and previously I have my app registered on that fingerprint in Google developer console, and I worked on that app in Eclipse by that API key. Is the same API key can be worked on this my project in Android Studio? ![]() android ![]() google-maps ![]() android-studio
| ||||
a comment |
28 Answers
activeoldestvotesup vote749down voteaccepted | Easiest ways ever:There are two ways to do this. |
shareimprove this answer | edited Jul 4 at 15:14 micstr 2,10822150 | answered Dec 11 '15 at 12:22 ![]() Hiren Patel 26.3k1296105 |
| Great :) but can I use the this SHA1 (Produced as you described) in my Google Developer Console to create a Credentials for my application? Because it in (Signing Report) window it says (config: debug) not release mode? – Ashraf Alshahawy Jan 25 '16 at 13:35 | ||
| Nice to have way to find it that doesn't involve the command line. – Androidcoder Jan 28 '16 at 19:00 | ||
| What about release... – Vlado Pandžić Feb 8 '16 at 20:50 | ||
| you are the shit dude this works perfectly since I couldnt locate debug.keystore in my .android folder @HirenPatel – Manny265 Mar 7 '16 at 9:34 | ||
| As of Android Studio 2.2 it shows up in Gradle console not Run – adsamcik Sep 21 '16 at 7:02 |
comments
![](https://oscdn.geek-share.com/Uploads/Images/Content/201909/10/d7d646f4d3cd91a472d13d866ea81ca3.png)
![](https://engine.adzerk.net/i.gif?e=eyJhdiI6NDE0LCJhdCI6NCwiYnQiOjAsImNtIjo0NzE0OTMsImNoIjoxMTc4LCJjayI6e30sImNyIjoxNjM4OTg3LCJkaSI6IjFiMDg1NWY5ODJiZDRiMDU5MWM0ZTQ4M2UyNDdiOWIwIiwiZG0iOjEsImZjIjoxOTQzNDM4LCJmbCI6MjE0MjMxMiwiaXAiOiIyMjMuMjIzLjE5Ni4xNzAiLCJrdyI6ImFuZHJvaWQsZ29vZ2xlLW1hcHMsYW5kcm9pZC1zdHVkaW8iLCJudyI6MjIsInBjIjowLCJlYyI6MCwicHIiOjE2MDQsInJ0IjoxLCJzYSI6IjMiLCJzYiI6ImktMDZjYTNmODA3NTc2YzU2MWMiLCJzcCI6MzA3OTYsInN0Ijo4Mjc3LCJ1ayI6InVlMS03OGJjMjcxMWNlOGY0N2NmOTIwZGQ0ZTdmZTQ2MjRhZSIsInpuIjo0NCwidHMiOjE1MDQyMTgxNDY0OTMsImJmIjp0cnVlLCJwbiI6ImFkemVyazEzNTE2NjYzODgiLCJmcSI6MH0&s=fEOq5SNjZeZKNHciwX7HNA2dozw)
up vote257down vote | My problem is the same as I have also shifted my Google Maps project from Eclipse to Android Studio. I have solved my problem by following this: Go to your Java bin directory via the command: C:\Program Files\Java\jdk1.7.0_71\bin> Now type in the below command in your command window (CMD.EXE): keytool -list -v -keystore c:\users\your_user_name\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android Example: keytool -list -v -keystore c:\users\James\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android Or you can just write this in cmd if you don't know the username: keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android And you will get the SHA1. Then I created a new key from https://code.google.com/apis/console because of my package name got changed and then use this key in my application. It works fine. Make sure you are in BIN folder of jdkX.X.X_XX (my folder name is jdk1.7.0_71), or else if you don't know what folder name you have then find it by opening the Java folder, and you will see what the folder name is, but you must be in your BIN folder and then run this command. Today I have got my SHA1 value in a cmd command window by the above procedure. SNAPSHOT: ![]()
| ||||||||||||||||||||
a comment |
up vote105down vote | I just found the case to get SHA-1 in Android Studio: Click on your package and choose New -> Google -> Google Maps Activity Android Studio redirects you to google_maps_api.xml And you will see all you need to get google_maps_key. ![]()
| ||||||||
a comment |
up vote88down vote | For Mac, this worked perfectly:keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android (A Google search landed me here.)
| ||||||||
a comment |
up vote27down vote | The best solution for generating an SHA-1 key for Android is from Android Studio. Click on Gradle on the far right side: ![]() Click on the refresh icon, and you will see the name of the app: ![]() Click on Tasks -> Report -> Signing Report: ![]() Find the SHA-1 key on the bottom part in the console: ![]()
| ||||||||||||||||
a comment |
up vote19down vote | i am going with @Hiren Patel answer but slightly change in android studio 2.2![]()
| ||||||||||||||||
a comment |
up vote19down vote | [Updated 2017] Step 1: On Top Right side of Android Studio Click On Gradle option. ![]() Step 2: -- 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 signingReport (You will get SHA1 and MD5 in Gradle Console/Run Bar) ![]() Step 3: Click on the Gradle Console option present bottom of Android Studio to see your SHA1 Key. ![]() Step 4: Now you got the SHA key but you can't run your project.That is why Change your configuration to app mode. See image below. ![]() Like this. ![]() Step 5: Happy Coding!!
| |||
add a comment |
up vote10down vote | For Linuxkeytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
| ||||||||||||||||
a comment |
up vote10down vote | I directly used the following command from my Mac using the terminal. I got SHA1 Finger. This is the command:keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
| ||||||||
a comment |
up vote7down vote | It's very very easy in Gnu/Linux - Mac - Windows First: - copy this command keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android Second: Now copy and paste the command in the terminal the Android Studio ![]() Result! ![]() Good Luck!!
| ||
add a comment |
up vote7down vote | For getting SHA1 for a production keystore: Build --> Generate Signed APK... Create keystore with password and follow the steps Go to your Mac/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin and drag the bin folder to the terminal after cd command to point at it so you can use the keytool tool. So, in terminal write cd(drag bin here) then press enter. Then, copy and paste this in the terminal: keytool -exportcert -alias Your_keystore_AliasName -keystore /Users/Home/Development/AndroidStudioProjects/YoutubeApp/app/YoutubeApp_keystore.jks -list -v Erase my path and go where you stored your keystore and drag your keystone and drop it after -keystorein the command line so the path will get created. Also, erase Your_keystore_AliaseName to put your alias keystone name that you used when you created it. Press Enter and enter the password :) When you enter the password, the terminal won't show that it receives keyboard entries, but it actually does, so put the password and press Enter even if you don't see the password is typed out.
| ||||
a comment |
up vote6down vote | If you have Android Studio then it is very very simple. Just create a MapActivity using Android Studio and after creating it go into google_maps_api.xml. In there there will be a link given in comments. If you paste it in your browser, it will ask a few details to be filled in and after that your API will be generated. There is no need of using keytool and all. Screen shot: ![]()
| ||||||||||||
a comment |
up vote6down vote | If you are using Android Studio, you can get the SHA-1 and MD5 certificate fingerprint (debug, release... all Build Types!!) fast through Gradle Tasks: signingReport The SHA-1 and MD5 certificates are shown in Messages Logs. Android Plugin (configured in the Gradle app) creates a debug mode for default. com.android.application File route to keystore: HOME/.android/debug.keystore I recommend to attach debug.keystoreto build.gradle. To do this put a file, debug.keystore, in an app folder and then Add SigningConfigs in Gradle app: apply plugin: 'com.android.application' android { ................ signingConfigs { debug { storeFile file("../app/debug.keystore") storePassword "android" keyAlias "androiddebugkey" keyPassword "android" } release { storeFile file("../app/debug.keystore") storePassword "android" keyAlias "androiddebugkey" keyPassword "android" } } ........ } Extra: If you want creates for release, put a file, release.keystore, in an app folder. (This example uses the same debug.keystore.)
| ||||||||
a comment |
up vote4down vote | For Windows 10, from the Android Studio terminal: keytool -exportcert -alias androiddebugkey -keystore %USER_PROFILE%"/.android/debug.keystore -list -v Note: For the debug.keystore, the password is "android". The debug keystore is typically located at "%USER_PROFILE%"/.android/debug.keystore.
| |||
add a comment |
up vote4down vote | I want to add one thing with the answer given by Softcoder. I have seen some people couldn't give their debug.keystore path correctly on the command line. They see that they are doing the exact process accepted above, but it is not working. At that point try to drag the debug.keystore and drop it on the command line. It will help if the accepted answer is not working for you. Do the full process without any hesitation. It was a nice answer.
| |||
add a comment |
up vote3down vote | I found a very easy process to find you MD5, SHA-1 fingerprint using Android Studio. Run your project Go to Gradle Menu (Menu: View -> Tool Windows -> Gradle) Go to 'signingReport' in Gradle window. (Your project -> Tasks -> android -> signingReport) Run it. (Using double-click or Ctrl + Shift + F10) In Run window you will find all info.
| |||
add a comment |
up vote3down vote | Use simple command: keytool -exportcert -keystore path-to-debug-or-production-keystore -list -v and you will get the SHA1 key.
| ||
add a comment |
up vote2down vote | Click the Gradle icon on the right panel, then click on the (root). Tasks > android > signingReport Then the Gradle script will execute, and you will see your keys.
| |||
add a comment |
up vote2down vote | Use the instructions from the API Manager using keytool: Get the package name from your AndroidManifest.xml file. Then use the following command to get the fingerprint: keytool -list -v -keystore mystore.keystore
| ||
add a comment |
up vote2down vote | This worked in my case: Use %USERPROFILE% instead of giving path .keystore file stored in this path automatically C:Users/user name/.android: keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
| |||
add a comment |
up vote2down vote | I do it this way: Step 1: Go to this folder On Mac: /Users//.android/ On Windows: C:\Documents and Settings\.android\ On Linux: ~/.android/ Step 2: Run this command line: keytool -list -v -keystore debug.keystore -storepass android You will see the SHA-1 key.
| |||
add a comment |
up vote1down vote | This worked for me:keytool -exportcert -alias androiddebugkey -keystore Put path-to-debug-or-production-keystore here like C:\users\youruser.android\debug.keystore -list -v Make sure you already are in the Java\jdk*\bindirectory in a command or terminal window. Then use Android as the password. Sometimes web resources could be misleading. These are the ones working: SHA1 Fingerprint Tutorial Quick Start Sample app
| |||
add a comment |
up vote1down vote | If you need SHA1 for Google Maps, you can just see your error log in LogCat.
| |||
add a comment |
up vote1down vote | When creating a new "Google Maps Project", in Android Studio V 1.5.1, the last screen opens the google_maps_api.xmlfile and displays the screen with instructions as follows: Resources: TODO: Before you run your application, you need a Google Maps API key. To get one, follow this link, follow the directions and press "Create" at the end: https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r= YOUR SHA-1 + YOUR PACKAGE NAME You can also add your credentials to an existing key, using this line: YOUR SHA-1:YOUR PACKAGE NAME Alternatively, follow the directions here: https://developers.google.com/maps/documentation/android/start#get-key Once you have your key (it starts with "AIza"), replace the "google_maps_key" string in this file. <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR GOOGLE MAPS KEY</string> To get YOUR GOOGLE MAPS KEY just cut and paste the URL link given into your browser and follow the instructions above at the time of creating the new application. The SHA-1and Package namesare already in the link given so you do not need to know them. They will however be in your project in the resources>Values>google_maps_api.xmlfile which is completed when you follow the instructions on creating the project.
| |||
add a comment |
up vote0down vote | Go to File > Project Structure Select 'app' or 'mobile' whatever you gave the name from 'Modules' Choose 'Signing' tab. You can add certificate clicking on the '+' button.
| ||||
a comment |
up vote0down vote | The easiest way to get the finger print is to switch from app to signed report by clicking the drop down and click build.![]() Then you will be able to see the sha1 fingerprint at the bottom pane where you see the debug report and stack trace. N.B remember to switch back to app when you want to run your app on a device or an emulator.
| ||
add a comment |
up vote0down vote | You can use following command and change AJAY SUNDRIYAL with your system name.This is only for your debug.keystore.This will work for you.C:\Program Files\Java\jdk1.8.0_91\bin>keytool -list -v -keystore "c:\users\AJAY SUNDRIYAL\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
| ||
add a comment |
up vote0down vote | The path of the keystore is in double quotes. It is working fine.keytool -list -v -keystore "C:\Users\App innovation\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
| |||
add a comment |
protected by Community♦ Apr
2 '16 at 10:00
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation onthis site (the association
bonus does not count).
Would you like to answer one of these unanswered
questions instead?
Not the answer you're looking for? Browse other questions tagged
![](https://i.stack.imgur.com/tKsDb.png)
android
![](https://i.stack.imgur.com/uE37r.png)
google-maps
![](https://i.stack.imgur.com/xqoqk.png)
android-studio or ask
your own question.
相关文章推荐
- How to enable the Xdebug debugger in Zend Studio for Eclips
- How to disable gradle 'offline mode' in android studio?
- How to change the default browser to debug with in Visual Studio 2008?
- How to change the resolution in text mode for Linux5+
- How to get Intellisense for Web.config and App.config in Visual Studio .NET?(转载)
- How to debug release mode program in visual studio
- How to get the url of a page in OpenERP?
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
- How to set bmp for your UserControl in the toolbox
- How to fix no public key available for the following key IDs in debian
- how to put the text on the left of a radio button in android
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
- How to get file path in onActivityResult in Android 4.4
- (OK) how to compile the source code for Android-x86 (Android 7.1.1)
- How to get the handle in windows using python
- How to debug a Visual Studio .NET 2005 Add-In
- Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- How to get the latest FFmpeg binaries for Windows
- How to get the available RAM and the cpu usage in percents?