Problem importing FireBase Analytics into Unity

Viewed 9325

I have a project at Unity 2019.3 with dotnet 4.x. I am trying to import firebase analicts and I have gotten the following error:

System.TypeInitializationException: The type initializer for 'Firebase.Editor.Measurement' threw an exception. ---> System.MissingMethodException: void Google.EditorMeasurement.set_InstallSourceFilename(string) --- End of inner exception stack trace --- at Firebase.Editor.AndroidSettingsChecker..cctor () [0x0000c] in Z:\tmp\tmp.SHkOPK7iEJ\firebase\app\client\unity\editor\src\AndroidAPILevelChecker.cs:37

and

MissingMethodException: void Google.EditorMeasurement.set_InstallSourceFilename(string)

Does anyone have any idea what it could be? Was any library missing? I haven't found reference to this problem anywhere.

3 Answers

I had the exact same problem, I fixed it by fully removing the ExternalDependencyManager folder in the project and replaced it using the latest Jar Resolver plugin from here https://github.com/googlesamples/unity-jar-resolver/blob/master/external-dependency-manager-latest.unitypackage

At the same time I also installed Python 2.7 and added it to system path, but I'm pretty sure the jar resolver thing is what fixed the issue. The root problem is the embedded analytics (EditorMeasurement) fail and Firebase never executes the python scripts that make all the Plugins/Firebase/res/values xmls

Hope this helps! :)

In my case the issue was happening after adding a new Firebase package with a version bigger than the other Firebase packages already in the project. Updating all the packages to the same version solved the problem.

deleting the editor folder inside the PlayServicesResolver folder and then reimporting it from any of the firebase unity packages.

Related