Error: No Firebase App ‘[DEFAULT]’ has been created – name firebase.initializeApp()
"@react-native-firebase/analytics": "^21.11.0",
"@react-native-firebase/app": "^21.11.0",
"react-native": "0.79.5",
"expo": "^53.0.17",
Earlier than the improve analytics used to work and there was no subject. The config was okay. After the improve we needed to change some js init code and the issues arose. Additionally it’s price mentioning that it really works on android, which leads me to consider that there could be a problem with GoogleService-Information.plist
The setup:
"@react-native-firebase/app"
is added to plugins.
each
google-services.json
GoogleService-Information.plist
are added to .env and uploaded to EXPO
analytics.js
import { getApp } from '@react-native-firebase/app'
import {
logEvent,
setAnalyticsCollectionEnabled,
getAnalytics,
} from '@react-native-firebase/analytics'
const app = getApp()
export default {
analytics: () => {
const analytics = getAnalytics(app)
return {
logScreenView: params => logEvent(analytics, 'screen_view', params),
setAnalyticsCollectionEnabled: enabled =>
setAnalyticsCollectionEnabled(analytics, enabled),
logEvent: (occasion, params) => logEvent(analytics, occasion, params),
setUserProperty: (title, worth) => analytics.setUserProperty(title, worth),
}
},
}
App.js
import analyticsModule from './lib/analytics'
const analytics = analyticsModule.analytics()
analytics?.setAnalyticsCollectionEnabled(true)
useAuth.getState().addOnSignedInListener(() => {
analytics?.setUserProperty('logged_in', 'true')
})
useAuth.getState().addOnSignedOutListener(() => {
analytics?.setUserProperty('logged_in', 'false')
})
GoogleService-Information.plist
CLIENT_ID
xxxx.apps.googleusercontent.com
REVERSED_CLIENT_ID
com.googleusercontent.apps.xxxx
ANDROID_CLIENT_ID
xxxx.apps.googleusercontent.com
API_KEY
xxxx
GCM_SENDER_ID
xxxxx
PLIST_VERSION
1
BUNDLE_ID
com.xx.xxxxxx
PROJECT_ID
xxxxx-mobile
STORAGE_BUCKET
xxxxx-mobile.appspot.com
IS_ADS_ENABLED
IS_ANALYTICS_ENABLED
IS_APPINVITE_ENABLED
IS_GCM_ENABLED
IS_SIGNIN_ENABLED
GOOGLE_APP_ID
1:xxxxx:ios:xxxxxxx
Any thought what the difficulty could be?