Keytool generates SHA1 fingerprint instead of MD5?
If you add the -v (verbose) option to your command line, like
keytool -v -list -alias alias_name -keystore my-release-key.keystore
it should show you the MD5 fingerprint
Using keytool to get the MD5 signature of a certificate
Solved by going back to java 1.6.
SHA-1 fingerprint of keystore certificate
Follow this tutorial for creating SHA1 fingerprint for Google Map v2
For Debug mode:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
for Release mode:
keytool -list -v -keystore {keystore_name} -alias {alias_name}
example:
keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test
On windows, when keytool command is not found, Go to your installed JDK Directory e.g.
<YourJDKPath>\Java\jdk1.8.0_231\bin\
, open command line and try the above commands for debug/release mode.
Another way of getting your SHA1 OR SHA-256 use ./gradlew signingReport
For more detailed info visit
Using Gradle's Signing Report
How do I generate my MD5 and SHA1 thumbprints using eclipse for debug keystore (Android)
get your sha1 and md5 thumbprint for debug keystore (also works for your other keystores).
Go to you package exporler in eclipse (defaults to the left side) right click it>android tools>export signed application package
Then navigate to your debug keystore normally in your .android folder and select it
Then enter the password which is "android" with no quotes
Next it will ask for an alias click the drop down list and select androiddebugkey and again, enter android as the password.
Next if you scroll down it will show the MD5 and SHA1 thumb print if you scroll down
then just cancel and use it how you want if you want your hash key just paste this under your onCreate
REPLACE "com.you.name" to your application package name.
PackageInfo info;
try {
info = getPackageManager().getPackageInfo( "com.you.name",PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures)
{
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String something = new String(Base64.encode(md.digest(), 0));
//String something = new String(Base64.encodeBytes(md.digest()));
Log.e("Hash key", something);
}
} catch (NameNotFoundException e1) {
Log.e("name not found", e1.toString());
} catch (NoSuchAlgorithmException e) {
Log.e("no such an algorithm", e.toString());
} catch (Exception e) {
Log.e("exception", e.toString());
}
How I get My MD5 and SHA-256?
Based on this answer for SHA-1
You should:
- On Android Studio got Terminal window (View > Tool Windows > Terminal);
- Paste this code
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
And should have something like this
How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
Easiest ways ever:
Update added for Android Studio V 2.2 in last step
There are two ways to do this.
1. Faster way:
- 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 signingReport (You will get SHA1 and MD5 in Run Bar(Sometimes it will be in Gradle Console))
- Select app module from module selection dropdown to run or debug your application
Check the screenshot below:
2. Work with Google Maps Activity:
- Open Android Studio
- Open Your Project
- Click on File menu -> Select New -> Click on Google -> Select Google Maps Activity
- A dialog would appear -> Click on Finish
- Android Studio would automatically generate an XML file named with
google_maps_api.xml
- You would get debug SHA1 key here (at line number 10 of the XML file)
Check Screenshot below:
Android Studio V 2.2 Update
There is an issue with Execution.
Solution:
- Click on Toggle tasks execution/text mode from Run bar
Check Screenshot below:
Done.
Related Topics
How to Size an Android View Based on Its Parent's Dimensions
Open Failed: Eacces (Permission Denied)
How to Integrate Opencv Manager in Android App
How to Rotate the Android Emulator Display
How to Determine If Network Type Is 2G, 3G or 4G
How to Restrict Android App to Specific Device Make
How to Scale a Website for Mobile Devices
Android How to Use Environment.Getexternalstoragedirectory()
Android Lollipop, Appcompat Actionbar Custom View Doesn't Take Up Whole Screen Width
Android - Webview Language Changes Abruptly on Android 7.0 and Above
Android - Application (Apk) Maximum Size
What's the Android Adb Shell "Dumpsys" Tool and What Are Its Benefits
Android Studio How to Package Single Aar from Multiple Library Projects
How to Put Gridview Inside Scrollview
Incompatibleclasschangeerror After Updating to Android Build Tools 25.1.6 Gcm/Fcm
Permission Denial: This Requires Android.Permission.Interact_Across_Users_Full