Connect ReactNative Project to Firebase Project — Android
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.json
file 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: