firebase / firebase/firebase-unity-sdk

[Bug] Don't call Firebase functions before CheckDependencies has finished

Open
#1,075 11 comments 0 reactions 0 assignees View on GitHub
api: analytics api: core type: feature request
Dominant language
C#
Stars
320
Forks
60
Avg merge
11h 15m
Merged PRs (30d)
11

Description

### Description

```
Non-fatal Exception: java.lang.Exception: InvalidOperationException : Don't call Firebase functions before CheckDependencies has finished
at Firebase.FirebaseApp.ThrowIfCheckDependenciesRunning(Firebase.FirebaseApp)
at Firebase.FirebaseApp.GetInstance(Firebase.FirebaseApp)
at Firebase.FirebaseApp.get_DefaultInstance(Firebase.FirebaseApp)
at Firebase.Analytics.FirebaseAnalytics..cctor(Firebase.Analytics.FirebaseAnalytics.)
```

Why is this a thing? Why is accessing Static fields(FirebaseAnalytics.EventScreenView and FirebaseAnalytics.ParametersScreenName) an issue?
**We had an issue where RemoteConfig did not work if Firebase functions were called before CheckDependencies finished, however I have no info if this is happening to these users...**

Please remove this exception and ensure that it works normally even if a FirebaseFunction is called.

### Reproducing the issue

This is happening to our live users and reported through Crashlytics, so repocase is not known.
I would assume a slow device should produce this...

### Firebase Unity SDK Version

11.7.0

### Unity editor version

2022.3.38f1

### Installation Method

.unitypackage

### Problematic Firebase Component(s)

Analytics

### Other Firebase Component(s) in use

Crashlytics, Remote Config

### Additional SDKs you are using

AppLovin MAX, Qonversion

### Targeted Platform(s)

Android

### Unity editor platform

Windows

### Scripting Runtime

IL2CPP

### Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

### Relevant Log Output

```shell
Non-fatal Exception: java.lang.Exception: InvalidOperationException : Don't call Firebase functions before CheckDependencies has finished
at Firebase.FirebaseApp.ThrowIfCheckDependenciesRunning(Firebase.FirebaseApp)
at Firebase.FirebaseApp.GetInstance(Firebase.FirebaseApp)
at Firebase.FirebaseApp.get_DefaultInstance(Firebase.FirebaseApp)
at Firebase.Analytics.FirebaseAnalytics..cctor(Firebase.Analytics.FirebaseAnalytics.)
```

### If using CocoaPods for Apple platforms, the project's Podfile.lock

Expand Podfile.lock snippet

```yml

👀 Replace this line with the contents of your Podfile.lock!

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.