1

I build react native app with react-native-firebase and I generate sha1 by these steps

  1. run project in android studio
  2. Click on Gradle menu.
  3. Expand Gradle Tasks tree
  4. Double click on android -> signingReport and then get the sha1

The problem is that some developers works on the project from different computers, same project but the sha1 of the apk has changed and each time I need to get the sha1 from the debug apk and upload it to firebase console and then download new google-service.json to android and googleInfo.plist to ios.

without it I get errors with authentication since it not recognize the google-sevice..

How can I solve this issue? what I'm doing wrong?

Vidhi Dave
  • 5,614
  • 2
  • 33
  • 55
Manspof
  • 598
  • 26
  • 81
  • 173

3 Answers3

3

You can add signing config in build.gradle for debug, like

signingConfigs {
        debug {
            storeFile file("***.jks")
            storePassword "***"
            keyAlias "***"
            keyPassword "***"
        }
}

if multiple developers are working on same project it will work same keystore for everyone.

Anurag Chutani
  • 591
  • 1
  • 4
  • 15
1

By default, Android Studio signs all .apk files with default, unprotected debug.keystore that's created for you by Android SDK.

You could either manually create a new keystore that all developers are going to use from now on, or add each developer's debug.keystore signature (SHA-1) as authorized key to Firebase project.

To create a new keystore, use the following command:

keytool -genkey -v -keystore keystore_name.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

Then add it to your project, by right-clicking on the module of the app then choosing 'Open Module settings'. On the 'Signing' tab you can see the following:

Signing tab of module settings

Add your newly created keystore credentials and path here and you're good to go.

nstosic
  • 2,584
  • 1
  • 17
  • 21
  • and I don't need more to generate per developer each time? – Manspof May 24 '18 at 12:47
  • You need to generate keystore only once and add its SHA-1 signature to Firebase console only once. But you have to distribute that keystore to all development machines and setup build.gradle to use that keystore for signing the project. – nstosic May 24 '18 at 12:55
0

There is tow way:

First Way:
one is you can add SHA key of all the developer key in your firebase console and then share the JSON file.

Second Way:
1. Create Keystore
2. Generate SHA using that keystore. See Here
3. Add Generated SHA in firebase console and download latest json file.
4. Share keystore with another developer.
5. And finally, ask to put following code in your build.gradel file android section like following

buildTypes {
        debug {
            storeFile file("your keystore path")
            storePassword "keysotre-password"
            keyAlias "keystore-alias"
            keyPassword "keystore-password"
        }
    }
Dhaval Solanki
  • 4,589
  • 1
  • 23
  • 39
  • the first way I did but one developer, his sha1 changed everytime and our firebase console has like 10 difference sha1 and it take time each time to update to each dveloper – Manspof May 24 '18 at 12:45
  • Yes, I know its panic, Just do the second thing, – Dhaval Solanki May 24 '18 at 12:47