Error You attempted to use a firebase module that's not installed on your Android project

I’m trying to add notification to my expo cli project so I choosed react native firebase notification. and I had this error :

    useEffect(() => {
       // Assume a message-notification contains a "type" property in the data payload of the screen to open
    
       messaging().onNotificationOpenedApp(remoteMessage => {
         console.log(
           'Notification caused app to open from background state:',
           remoteMessage.notification,
         );
         
       });
    
       // Check whether an initial notification is available
       messaging()
         .getInitialNotification()
         .then(remoteMessage => {
           if (remoteMessage) {
             console.log(
               'Notification caused app to open from quit state:',
               remoteMessage.notification,
             );
             setInitialRoute(remoteMessage.data.type); // e.g. "Settings"
           }
           setLoading(false);
         });
     }, []);

 if (loading) {
   return null;
 }

package.json:

 "@react-native-firebase/app": "^15.3.0",
    "@react-native-firebase/crashlytics": "^15.3.0",
    "@react-native-firebase/messaging": "^15.3.0",
    "@react-native-firebase/perf": "^15.3.0",

app.json:

"android": {
 "googleServicesFile": "./google-services.json"
}
      "plugins": [
          [
            "@react-native-firebase/app",        
            {
              "icon": "",
              "mode": "production"
            }
            
          ]

Console :

Error: You attempted to use a firebase module that’s not installed on your Android project by calling firebase.app().

Ensure you have:

  1. imported the ‘io.invertase.firebase.app.ReactNativeFirebaseAppPackage’ module in your ‘MainApplication.java’ file.
  2. Added the ‘new ReactNativeFirebaseAppPackage()’ line inside of the RN ‘getPackages()’ method list.

See React Native Firebase - A react native firebase library supporting both android and ios native firebase SDK's for full setup instructions.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.