I'm trying to initialize Firebase from JS as following:
But in both attemps i get the following error on the emulator:
Default FirebaseApp is not initialized in this process com.xxx. Make sure to call FirebaseApp.initializeApp(Context) first.
getInstance
null:-1
getInstance
null:-1
<init>
RNFirebaseAuth.java:50
createNativeModules
RNFirebasePackage.java:38
processPackage
NativeModuleRegistryBuilder.java:88
processPackage
ReactInstanceManager.java:950
createReactContext
ReactInstanceManager.java:891
access$600
ReactInstanceManager.java:104
doInBackground
ReactInstanceManager.java:218
doInBackground
ReactInstanceManager.java:197
call
AsyncTask.java:304
run
FutureTask.java:237
runWorker
ThreadPoolExecutor.java:1133
run
ThreadPoolExecutor.java:607
run
Thread.java:761
Am i doing anything wrong?
initizlizeApp in RNFirebase doesn't work like the web SDK. The docs need an update, as they don't accept the parameters as shown. You need to add an app on the firebase console, and add the google-services.json file or plist file (android/ios).
Could you be more specific?
I added the file and I get the same result
Do I need to also manually add google services?
What else should I do?
@lobo922 you also need to add google services to your gradle files, otherwise it won't get loaded
Closing this and making a note to update the android setup docs. @lobo922 if you still have an issue please reply and i'll re-open.
I'm getting the run-time error:
"Default FirebaseApp is not initialized in this process com.react_native. Make sure to call FirebaseApp.initiailizeApp(Context) first"
@hynese have you added Firebase to the to the delegate file?
@Ehesp Thank you for your reply. I somehow managed to get it to work.
I think I wasn't pulling in google-services correctly.
Here are my notes:
###
#Firebase:
###See: console.firebase.google.com
#Download: google-services.json
#Copy and paste it in to /app
Project-level build.gradle (<project>/build.gradle):
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:3.0.0'
}
}
App-level build.gradle (<project>/<app-module>/build.gradle):
...
// Add the following to react_native bundle.gradle:
dependencies {
...
compile "com.android.support:appcompat-v7:23.0.1"
...
}
// Add the following to "app" bundle.gradle
dependencies{
...
compile "com.android.support:appcompat-v7:23.0.1"
...
}
// Add to the bottom of the file (app bundle.gradle)
apply plugin: 'com.google.gms.google-services'
@hynese any chance you'd be able to review the installation docs on here and let me know if anything was missing based on your experience?
I am having this issue too. Any updates?
Hi @Salakar,
Yeah I did follow the setup for iOS works find but Android got an issue.
what do you mean by this:
"There are several ways to setup Firebase on Android. The easiest way is to pass the configuration settings in JavaScript. In that way, there is no setup for the native platform"
I have tried to pass the configuration when creating the firebase instance, but did not work for me.
it says : "Default FirebaseApp is not initialized in this process com.react_native. Make sure to call FirebaseApp.initiailizeApp(Context) first".
I have tried to include google-services.json file under android/app and the other two steps. but did not work. it says: "Google Play Services is required to run this application but no valid installation was found".
As the firebase documentation says when you setup an Android project, you need to include Google Services in your project:
https://github.com/invertase/react-native-firebase-tests/blob/master/android/build.gradle#L9
https://github.com/invertase/react-native-firebase-tests/blob/master/android/app/build.gradle#L144
Also @bakr-baroudi
what do you mean by this:
"There are several ways to setup Firebase on Android. The easiest way is to pass the configuration settings in JavaScript. In that way, there is no setup for the native platform"
Where are you reading this from?
EDIT: Mybad. This was pulled from Firestack. Needs changing.
@bakr-baroudi I have updated the docs now, can you look over them again and see if anything has been missed your end: https://github.com/invertase/react-native-firebase/blob/master/docs/firebase-setup.md
Thanks guys for replying. @Salakar @Ehesp
I am still getting this issue on Nexus 6A emulator (API 6.0).
Error Msg => "Google Play Services is required to run this application but no valid installation was found".
I change the debugging into my real device (API 7.0) then it works.
Ah that's because you've set your emulator up with no Google Services. Make
sure services are downloaded under SDK manager then make a new emulator
with services enabled.
On 7 Apr 2017 03:58, "bakr-baroudi" notifications@github.com wrote:
Thanks guys for replying. @Salakar https://github.com/Salakar @Ehesp
https://github.com/Ehesp
I am still getting this issue on Nexus 6A emulator (API 6.0).
Error Msg => "Google Play Services is required to run this application but
no valid installation was found".
I change the debugging into my real device (API 7.0) then it works.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/invertase/react-native-firebase/issues/9#issuecomment-292412741,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAzZXqP63RjzAVsho4LKAsiRk7zvXQqZks5rtaZngaJpZM4MhiZv
.
@bakr-baroudi for clarity, your emulators need to include "Google APIs" once you'd installed via SDK manager:

Wait a sec I am confused. My iOS app is working fine and I am passing the configuration information in js. The android app is not and is giving the not initialized error.
From what I am reading here, you are saying I can't configure this in js? I HAVE to configure this in JS as the connection information is coming down via json based on the tenant they have authenticated in to. So how do I configure this without hardcoding the app, which is not an option.
@victoriafrench That's an interesting use case that we hadn't envisaged! At the moment, as you've found, the initialisation relies on the GoogleServiceInfo.plist (iOS) and google-services.json (Android) files for configuration information.
We can certainly look at supporting custom configuration, we'd just been trying to keep it simple at first. Out of interest, are you needing to connect to multiple projects simultaneously? Or is there only one project active at any one time?
Is there any resolution for this? My iOS app works fine with dynamic configuration through JS but the Android app does not. I need to connect to a different firebase app based on my app's environment configuration and cannot have a static google-services.json file. Why have the firebase.initializeApp() function if it does not work on Android?
Most helpful comment
@victoriafrench That's an interesting use case that we hadn't envisaged! At the moment, as you've found, the initialisation relies on the
GoogleServiceInfo.plist(iOS) andgoogle-services.json(Android) files for configuration information.We can certainly look at supporting custom configuration, we'd just been trying to keep it simple at first. Out of interest, are you needing to connect to multiple projects simultaneously? Or is there only one project active at any one time?