expo-firebase-analytics

  1. SDK Version: 38
  2. Platforms(Android/iOS):

Hi please help me
I want to add Analytics from ‘expo-firebase-analytics’ to my Android/iOS app.
On IOS simulator i have the following issue
Firebase is not configured. Ensure that you have configured ‘GoogleService-Info.plist’ correctly.
I have GoogleService-Info.plist (I downloaded it from firebase console).

is it possible to resolve it without using Xcode and without ejecting?
If it is possible how to do it ?

my app.json

{
  "expo": {
    "name": "UPSK",
    "slug": "upsk",
    "sdkVersion": "38.0.0",
    "privacy": "public",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.0.7",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/logo.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0,
      "enabled": false
    },
    "assetBundlePatterns": [
      "assets/**"
    ],
    "packagerOpts": {
    },
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "com.upsk.app",
      "buildNumber": "1.0.7",
      "infoPlist": {
        "CFBundleAllowMixedLocalizations": true,
        "UIUserInterfaceStyle": "Light",
        "googleServicesFile": "./GoogleService-Info.plist",
        "UIBackgroundModes": ["audio"]
      },
      "config": {
        "googleMapsApiKey": "AIzaSyC00aYeJhkYfEw5woYH6NQI9X2HfVGzno4"
      },
      "splash": {
        "userInterfaceStyle": "light"
      },
      "userInterfaceStyle": "light"
    },
    "android": {
      "versionCode": 7,      
      "package": "com.upsk.app",
      "googleServicesFile": "./google-services.json",
      "useNextNotificationsApi": true,
      "config": {
        "googleMaps": {
          "apiKey": "AIzaSyD8dVIfkZ4AUqttpnOH5kOAead2y_Mo0HQ"
        }
      }
    },
    "locales": {
      "ru": "./languages/russian.json",
      "uk": "./languages/ukrainian.json"
    },
    "notification": {
      "androidMode": "default",
      "icon": "./assets/notificationIcon.png",
      "iosDisplayInForeground": true
    }
  }
}

Hey @alexhodovas,

It looks like you put your googleServicesFile under the infoPlist key. It needs to be directly under the ios key.

Cheers,
Adam

Thanks for advice about googleServicesFile.
But I still don’t see the analytics results. Can you help me again ?
my simple code looks like

        <View style={styles2.container}>
          <Button
            title={`Press me`}
            onPress={async () => {
              try {
                await Analytics.logEvent(
                  "ButtonTapped", {
                  name: "Home",
                  screen: "Home",
                });
              } catch (e) {
                console.log(e.message);
                alert(e.message);
              }
            }}
          />
        </View>

and i want to see ButtonTapped event here

the full app.json

{
  "expo": {
    "name": "UPSK",
    "slug": "upsk",
    "sdkVersion": "38.0.0",
    "privacy": "public",
    "platforms": ["ios", "android"],
    "version": "1.0.7",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/logo.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0,
      "enabled": false
    },
    "assetBundlePatterns": ["assets/**"],
    "packagerOpts": {},
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "com.upsk.app",
      "buildNumber": "1.0.7",
      "googleServicesFile": "./GoogleService-Info.plist",
      "infoPlist": {
        "CFBundleAllowMixedLocalizations": true,
        "UIUserInterfaceStyle": "Light",
        "UIBackgroundModes": ["audio"]
      },
      "config": {
        "googleMapsApiKey": "AIzaSyC00aYeJhkYfEw5woYH6NQI9X2HfVGzno4"
      },
      "splash": {
        "userInterfaceStyle": "light"
      },
      "userInterfaceStyle": "light"
    },
    "android": {
      "versionCode": 7,
      "package": "com.upsk.app",
      "googleServicesFile": "./google-services.json",
      "useNextNotificationsApi": true,
      "config": {
        "googleMaps": {
          "apiKey": "AIzaSyD8dVIfkZ4AUqttpnOH5kOAead2y_Mo0HQ"
        }
      }
    },
    "web": {
      "config": {
        "firebase": {
          "apiKey": "AIzaSyB96O4M0JfDxxMxFS9nN46-vu_bsgsElhc",
          "measurementId": "G-EKJYML18H0",
          "authDomain": "test-431eb.firebaseapp.com",
          "databaseURL": "https://test-431eb.firebaseio.com",
          "projectId": "test-431eb",
          "storageBucket": "test-431eb.appspot.com",
          "messagingSenderId": "76582153252",
          "appId": "1:76582153252:web:6a49d4de4af2201eb9bcb1"
        }
      }
    }
  },
  "locales": {
    "ru": "./languages/russian.json",
    "uk": "./languages/ukrainian.json"
  },
  "notification": {
    "androidMode": "default",
    "icon": "./assets/notificationIcon.png",
    "iosDisplayInForeground": true
  }
}

изображение

Happy to hear things are working for you now! Good luck with your project moving forward.

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