Connect ReactNative Project to Firebase Project — Android

Andrea Huang
3 min readJun 10, 2021

The following Firebase features are needed by ReactNative App

  • Authentication
  • Firestore Database
  • Push Notification
  • Dynamic Links
  • AdMob

Reference :

https://rnfirebase.io/

1. ReactNative Project: Install dependency library

npm install --save @react-native-firebase/app

2. Android Part 1 : Keystore for both development and production

2.1 Copy debug.keystore to /android/app/src/debug

2.2 Create folder /android/app/src/release

2.3 Generate release.keystore

keytool -genkey -v -keystore 'release.keystore' -alias <ALIAS> -storepass <STOREPASS> -keypass <KEYPASS> -keyalg RSA -validity 3650

2.4 Copy release.keystore to /android/app/src/release

2.5 Update /android/app/build.gradle for the signing config

Before vs After

2.6 Check the SHA1 of both debug.keystore and release.keystore

Take note of them as we will use it in next step.

keytool -list -keystore <PATH_to_KeyStore> -alias <ALIAS>

3 Android Part 2: Setup Firebase project Android app.

3.1 Register the app

Make sure the Package name and App name are aligned with the RN project, also copy the SHA1 value from step above.

  • Package Name: com.bwisely
  • App Name: Wisely

2. Download google-services.jsonfile of both firebase projects and place them inside of your project at the following location:

/android/app/src/debug/google-services.json

/android/app/src/release/google-services.json

3. Update Project-level build.gradle (<project>/build.gradle) as instructed on Firebase console

Before vs After:

4. Update App-level build.gradle (<project>/<app-module>/build.gradle):

Before and After:

--

--

Andrea Huang

我的Patrick是個6歲的小男孩。我想記錄下此時我想與他分享的感悟。雖然他此時未必能理解,但是等到適當的時機,他可以讀到來自媽媽當年的分享