工程中导入Firebase Analytisc dotnet4的库后,编辑器下报错如下:
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.pxoeYNk3oG\firebase\app\client\unity\editor\src\AndroidAPILevelChecker.cs:37
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])
同时打出的ios包Firebase也疯狂报错。
报错原因分析:
1,之前导入过Firebase库,又导入了,存在冲突
2,项目包名改了,同步有问题
解决步骤(详见 这里):
- Deleting anything called
ExternalDependencyManager
- Deleting anything called
PlayServicesResolver
- then download the most recent version of EDM4U,and import it to Unity.
Firebase Analytics Quickstart 对Firebase Analytics的集成有比较详细的描述,值得参考