Search code examples
react-nativereact-native-cli

How to Get SHA-1 key in React Native cli?


In React Native when I'm trying to get Google GPS API key in Google console, I have seen package name and SHA-1 key where to I get SHA-1 key in React Native

How to get SHA-1 key in React Native cli? (not in Expo).


Solution

    1. Windows:
      – Open a terminal window

      – Change the directory to the JDK bin directory. The path of the JDK depends upon the operating system you are using

      cd C:\Program Files\Java\jdk1.8.0_121\bin

      – Now we have to run the following command using the keytool.exe file in JDK/bin

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

      enter image description here

    2. Ubuntu/Mac

      – Open a terminal window

      – Now run the following command

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

      enter image description here

    For more details click Here

    1. From React-native Project:
      – Run this command in React-Native App directory

      cd android && ./gradlew signingReport

      – copy the SHA1 from the debug key (This generates two variant keys. You can copy the 'SHA1' that belongs to the debugAndroidTest variant key option.)