As a Flutter developer, it's essential to know how to get the SHA-1 key for your Android app. The SHA-1 key is a unique identifier for your app that allows you to authenticate your app with Google services like Firebase, Google Maps, and more. In this blog post, we'll show you how to get the SHA-1 key in Flutter using Android Studio and VSCode.
Step 1: Opening Your Flutter Project in Android Studio: To begin, launch Android Studio and open your Flutter project. If you haven't installed Android Studio, it is recommended to do so as it provides a comprehensive set of tools and features for Android development.
Step 2: Navigating to the Android Folder: Once your project is open, navigate to the left-hand side of the interface, where you'll find a tree structure representing your project's files and directories. Look for the "Android" folder, which resides within your project's directory.
Step 3: Opening the Terminal in Android Studio: Right-click on the "Android" folder and select "Open in Terminal." This action will open the terminal within Android Studio, conveniently placing you inside the Android directory of your project.
Step 4: Executing the Gradlew Command: To retrieve your SHA1 key, you need to execute a command within the terminal. The command is "gradlew signingReport" However, it is important to note that hitting the Enter key alone may result in an error. To avoid this, press Ctrl + Enter to execute the command properly.
Step 5: Retrieving Your SHA1 Key: After executing the command, the terminal will split, and the signing report process will commence. This process might take a few moments to complete, as it analyzes the corresponding ID features.
Step 6: Obtaining Your SHA1 and SHA256 Keys: Once the process finishes, you will be presented with your SHA1 and SHA256 keys. These keys are essential for integrating various services into your Flutter project, such as Firebase Authentication and Google Sign-In. Make sure to copy these keys and store them securely.
Getting the SHA-1 Key in VSCode
Follow these steps to get the SHA-1 key for your Android app using VSCode:
Step 1: Open VSCode
Open VSCode and open your Flutter project.
Step 2: Open Terminal
Click on the "Terminal" tab at the bottom of the VSCode window.
Step 3: Navigate to Android Folder
In the terminal, navigate to your Android folder by running the following command:
Niranjan Dahalcd android
Step 4: Run Gradlew Task
Run the following Gradlew task in the terminal:
Niranjan Dahal./gradlew signingReport
Step 5: Copy SHA-1 Key
After running the Gradlew task, the SHA-1 key will be displayed in the terminal. Copy the SHA-1 key to use in your app.
Conclusion
Congratulations! You have successfully obtained your SHA1 key using Android Studio, even if you usually prefer coding in Visual Studio Code. By following these steps, you can simplify the process of retrieving your SHA1 and SHA256 keys for Flutter projects. Remember to subscribe for more insightful content and stay tuned for future articles that delve into exciting development techniques, best practices, and the latest trends in the ever-evolving world of mobile app development.