Android Tutorial
Software Setup and Configuration
Android Studio
File Structure
Components
Core Topics
Layout
View
Button
Intent and Intent Filters
Toast
RecyclerView
Fragments
Adapters
Other UI Component
Image Loading Libraries
Date and Time
Material Design
Bars
Working with Google Maps
Chart
Animation
Database
Advance Android
Jetpack
Architecture
App Publish
App Monetization
To generate SHA-1, MD5, and SHA-256 keys (or fingerprints) for your Android application in Android Studio, you'll typically use the keytool
utility that comes with the JDK. These fingerprints are often needed for API services, like Google Maps or Firebase, to identify your app.
Follow these steps to generate the keys:
Open Terminal in Android Studio:
Navigate to the Java Bin Directory (optional):
If keytool
isn't recognized as a command directly (common in Windows), you might need to navigate to the bin
directory of your JDK installation. For example:
cd C:\Program Files\Java\jdk1.8.0_231\bin
Adjust the path based on your JDK installation directory.
Generate the Key Fingerprints:
Use the following command:
keytool -list -v -keystore path_to_your_keystore.jks
Replace path_to_your_keystore.jks
with the path to your keystore file. If you're trying to get the fingerprint for your debug keystore, the path usually is:
For Windows:
C:\Users\Your_Username\.android\debug.keystore
For macOS or Linux:
~/.android/debug.keystore
If you're using the debug keystore, the default keystore password is android
.
View the Keys:
After running the command, you will be prompted to enter the keystore password. Once you provide the password, you'll see output that includes SHA-1, MD5, and SHA-256 fingerprints, among other details.
Remember:
Always keep your release keystore file and password secure. Losing the keystore means you won't be able to update your app on the Google Play Store. Exposing it can lead to malicious versions of your app being distributed.
If you're integrating a service like Google Maps or Firebase, you may need the SHA-1 fingerprint from both your debug and release keystores, especially if you're testing functionality in both debug and release modes.
Generate SHA-1 key in Android Studio:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
How to get MD5 key in Android Studio for Google Maps:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Android Studio generate SHA-256 key for Firebase:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Create SHA-1 fingerprint in Android Studio:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Generate MD5 key for debug keystore in Android Studio:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Get SHA-256 fingerprint for Firebase in Android Studio:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Android Studio generate keystore SHA-1 and SHA-256:
keytool -genkeypair -v -keystore your_keystore_filename.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias your_alias_name
Replace "your_keystore_filename" and "your_alias_name" with your desired values.
Obtain MD5 key for signing APK in Android Studio:
keytool -list -v -keystore your_keystore_filename.keystore -alias your_alias_name
Replace "your_keystore_filename" and "your_alias_name" with your actual keystore filename and alias.
Generate SHA-256 key for Google Play Console in Android:
keytool -list -v -keystore your_keystore_filename.keystore -alias your_alias_name
Replace "your_keystore_filename" and "your_alias_name" with your actual keystore filename and alias.