Generating SHA-1 for Flutter/React-Native/Android Apps

Generating SHA-1 for Flutter/React-Native/Android Apps

17 December 2024 Stephan Petzl Leave a comment Tech-Help

Generating a SHA-1 key is a crucial step when integrating third-party services like Google Sign-In in your Flutter, React-Native, or Android Native applications. This guide will help you understand how to efficiently generate the SHA-1 key using various approaches, depending on your development environment.

Using the Terminal

For Mac/Linux Users

Open your terminal and navigate to the project directory. Use the following command:

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

For Windows Users

Open the Command Prompt and navigate to your project directory. Run:

keytool -list -v -keystore "%USERPROFILE%\\.android\\debug.keystore" -alias androiddebugkey -storepass android -keypass android

Using Android Studio

If you prefer a GUI-based approach, Android Studio offers a straightforward way to obtain your SHA-1 key:

  1. Open your project in Android Studio.
  2. Select the android/app/build.gradle file.
  3. In the top right corner, click “Open for Editing in Android Studio”.
  4. Open the Gradle panel and double-click on “Signing Report”.

This will display the SHA-1 key in the Gradle console. Ensure you add both the debug and release keys to your Firebase console if you are using Firebase services.

Alternative Solution: Using Gradle Wrapper

Another approach involves using the Gradle wrapper, which can be effective across different platforms:

cd android
./gradlew signingReport

This command should be run from the terminal or command prompt in the android directory of your project. It will generate the SHA-1 key and display it for you to use in your project configurations.

Conclusion

Generating a SHA-1 key is an essential step in setting up authentication and other services in your mobile applications. By following the methods outlined above, you can efficiently obtain the necessary keys for your project, regardless of the development environment you are using.

If you are developing mobile applications and require robust testing solutions, consider using Repeato. As a no-code test automation tool, Repeato simplifies the process of creating, running, and maintaining automated tests for your Android and iOS apps. Its computer vision and AI-based testing capabilities make it particularly fast and efficient, ensuring your apps perform optimally across all platforms.

Like this article? there’s more where that came from!