Git Product home page Git Product logo

Comments (20)

chrisbianca avatar chrisbianca commented on May 17, 2024 2

@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?

from react-native-firebase.

 avatar commented on May 17, 2024 1

@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'

from react-native-firebase.

Salakar avatar Salakar commented on May 17, 2024 1

@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

from react-native-firebase.

Ehesp avatar Ehesp commented on May 17, 2024 1

from react-native-firebase.

Ehesp avatar Ehesp commented on May 17, 2024 1

@bakr-baroudi for clarity, your emulators need to include "Google APIs" once you'd installed via SDK manager:

image

from react-native-firebase.

deavial avatar deavial commented on May 17, 2024 1

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.

from react-native-firebase.

Ehesp avatar Ehesp commented on May 17, 2024

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).

from react-native-firebase.

lobo922 avatar lobo922 commented on May 17, 2024

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?

from react-native-firebase.

Salakar avatar Salakar commented on May 17, 2024

@lobo922 you also need to add google services to your gradle files, otherwise it won't get loaded

from react-native-firebase.

Salakar avatar Salakar commented on May 17, 2024

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.

from react-native-firebase.

 avatar commented on May 17, 2024

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"

from react-native-firebase.

Ehesp avatar Ehesp commented on May 17, 2024

@hynese have you added Firebase to the to the delegate file?

https://github.com/invertase/react-native-firebase-examples/blob/master/ios/ReactNativeFirebaseExamples/AppDelegate.m#L20

from react-native-firebase.

Salakar avatar Salakar commented on May 17, 2024

@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?

from react-native-firebase.

bakr-baroudi avatar bakr-baroudi commented on May 17, 2024

I am having this issue too. Any updates?

from react-native-firebase.

Salakar avatar Salakar commented on May 17, 2024

@bakr-baroudi have you followed the setup instructions from the readme for the platform you're on?

Platform setup guides:
ios android

from react-native-firebase.

bakr-baroudi avatar bakr-baroudi commented on May 17, 2024

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".

from react-native-firebase.

Ehesp avatar Ehesp commented on May 17, 2024

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

from react-native-firebase.

Ehesp avatar Ehesp commented on May 17, 2024

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.

from react-native-firebase.

bakr-baroudi avatar bakr-baroudi commented on May 17, 2024

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.

from react-native-firebase.

caseyt avatar caseyt commented on May 17, 2024

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?

from react-native-firebase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.