Open WiseKodama opened 1 month ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @WiseKodama, thanks for reaching out. The Firebase SDK checks to make sure that all the necessary dependencies are included before it runs.
Do you have the condition checker of CheckAndFixDependenciesAsync
before running any Firebase calls?
protected virtual void Start() {
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
dependencyStatus = task.Result;
if (dependencyStatus == DependencyStatus.Available) {
InitializeFirebase();
} else {
Debug.LogError(
"Could not resolve all Firebase dependencies: " + dependencyStatus);
}
});
}
You can take a look into our Firebase Unity Quickstart for reference. It'll help guide you in configuring your project correctly.
Let me know if that helps. Thanks!
I do but more complex projects do not work that way.
Sometimes you want to sent analytics event at app start, currently I create a queue and send them off once Firebase dependency checker is done.
However the issue is that to queue a specific event that uses for example FirebaseAnalytics.EventScreenView
will call the constructor on FirebaseAnalytics resulting in the error above.
Why doesn't firebase have a built in queuing system?
It seems counter productive that static fields throw this error, should we really have a check infront of every static field accessor relating to Firebase?
I understand and sorry for the issue you're experiencing right now. Unfortunately, the current design does not allow any calls prior to the CheckAndFixDependenciesAsync
. I know this is not ideal, and this is something we're still trying to work on.
There were also previous discussions of this in the quickstart. I did see an alternative posted by one of the developers, however I haven't tried it myself.
For now, I'll mark this as a feature request, and bring this up to our engineers to see if we have updates or future plans. However, please note that we currently don't have a timeline for this. I'll reply back here once we receive feedback. Thanks!
Description
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
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! ```