react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

NativeModules.RNFirebase returns UNDEFINED

Open creative-git opened this issue 9 years ago • 20 comments

after installation, i run the app and i get the following red screen error: cannot read property 'googleAPIAvailability' of undefined i tracked the issue and found that const FirebaseModule = NativeModules.RNFirebase; IN "node_modules/react-native-firebase/lib/firebase.js" is returning "undefined"

any help please ?

My RN is v0.44

creative-git avatar Jun 23 '17 13:06 creative-git

You haven't installed the library properly. Please follow the instructions and if you need more help show us your build.gradle files and MainActivity.

Ehesp avatar Jun 23 '17 13:06 Ehesp

thanks for the quick reply,

i followed the installation steps step by step, i\m on iOS, which files would u like for me to share ?

i forgot to mention that this error happen on running: const firebase = RNFirebase.initializeApp(configurationOptions);

creative-git avatar Jun 23 '17 13:06 creative-git

I has been screen error too.

image

My RN is v.0.44 and I followed the installation for IOS I used it podfile this https://github.com/invertase/react-native-firebase-examples/blob/master/ios/Podfile

simpleblack avatar Jun 23 '17 13:06 simpleblack

SOLVED .. i deleted the "build" folder in the ios (APP_ROOT_FOLDER/ios/build) and ran react-native run-ios again and all worked fine ! i guess something was not getting updated in the build folder

creative-git avatar Jun 23 '17 13:06 creative-git

@barjas I deleted the build and run-ios but i get next error

Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist

You don't get error?

simpleblack avatar Jun 23 '17 15:06 simpleblack

@simpleblack this is not related to firebase at all try clear cache , or run with sudo, ...or check this page, https://github.com/facebook/react-native/issues/7308

creative-git avatar Jun 23 '17 16:06 creative-git

@barjas thank you. I will try.

simpleblack avatar Jun 23 '17 16:06 simpleblack

@barjas I tried every method catch clear, sudo, re make file etc... but I get all error ":CFBundleIdentifier", Does Not Exist

my test.

  1. create react-native => success
  2. change BundleIdentifier => success || not change BundleIdentifier => success
  3. MyGame.xcworkspace indexing => success
  4. I followed the installation for IOS => fail('googleAPIAvailability' of undefined error)
  5. delete (APP_ROOT_FOLDER/ios/build/) and run-ios => fail(CFBundleIdentifier error)

I guess something pod init, pod install after get error Could you share used podfile?

Thank you.

simpleblack avatar Jun 23 '17 17:06 simpleblack

My app run is fine. But when I run "jest" (test app), the error raises. I tried to remove build folder and rerun react-native run-android, the result is still same. Can you take a look?

image

lehainam-dev avatar Jul 07 '17 08:07 lehainam-dev

@lehainam125 is this related? https://github.com/invertase/react-native-firebase/issues/215

Ehesp avatar Jul 07 '17 08:07 Ehesp

@Ehesp No, I don't think it's related. I've tried to add compile "com.google.android.gms:play-services-base:11.0.0" to my build.gradle, the error still appear.

lehainam-dev avatar Jul 07 '17 09:07 lehainam-dev

@lehainam125 Okay I'll take a look. https://github.com/invertase/react-native-firebase/issues/162 might be worth checking too.

Ehesp avatar Jul 07 '17 10:07 Ehesp

I have the same issue that @barjas had. RN 0.43.3

Tried deleting ios/build/ as well as ios/build/Build, and both result in the error that @simpleblack was having.

There seems to be no information anywhere about this "cannot read property 'googleAPIAvailability of undefined".

LA avatar Jul 29 '17 15:07 LA

Also getting error 'TypeError: Cannot read property 'googleApiAvailability' of undefined' when running npm test. Error occurs on this line const firebase = RNFirebase.initializeApp Deleting build folder and running react-native run-android again then npm test still doesn't work.

connercms avatar Aug 08 '17 14:08 connercms

Same issue here as @lehainam125. Works great in the app, throws this error in Jest.

johngoren avatar Aug 09 '17 08:08 johngoren

Same issue I have observed

image

nanduahmed avatar Aug 16 '17 02:08 nanduahmed

Getting NativeModules.RNFirebase undefined. Pretty sure I have followed all the steps suggested at here https://github.com/evollu/react-native-fcm Have linked library both manually and using rnpm link. Still getting the issue

PoojaVM avatar Mar 29 '18 13:03 PoojaVM

Me too,

On Android.

I use react-native-jitsi-meet library in conjuntion with this, and this problem raised.

I detailed the issue for test here Crash on Android, possible conflict with react-native-firebase plugin

When the plugin call startReactApplication to start app with jitsi view firebase plugin try to initialize RNFirebase that is not defined in that sdk.

In firebase.js, in the constructor this checks if FirebaseCoreModule (NativeModules.RNFirebase) is defined, it isn't so, fire an exception.

This initialization is not needed and causes the application crash

RicardoBer avatar Jan 18 '19 20:01 RicardoBer

@RicardoBer did you find any solution for this?

saadqbal avatar Apr 12 '19 08:04 saadqbal

I can make it work after many weeks, it's no joke, many weeks. After make a lot of changes on many code places and change xcode config, but I can't reproduce the solution.

I can build and make the app works but I can't make it again. The project is ended (lost money and time with it) and I can't make more test, Sorry.

The only conclusion I have is that it is not related to firebase problem, it is related to xcode and react native problem, but arrise on extrange sites.

Sorry, if I have more time to test and find the solution I publish it here.

RicardoBer avatar Apr 15 '19 17:04 RicardoBer