Reputation: 695
I am planning to introduce Firebase to add a push notification function to the game I made with Unity.
I pasted the application-specific google-services.json in the Asset folder, I installed FirebaseMessaging.unitypackage of SDK downloaded from here, but I get an error.
Console
Unloading broken assembly Assets/Firebase/Plugins/Firebase.App.dll, this assembly can cause crashes in the runtime
Unloading broken assembly Assets/Firebase/Plugins/Firebase.Messaging.dll, this assembly can cause crashes in the runtime
Unloading broken assembly Assets/Firebase/Plugins/Firebase.Platform.dll, this assembly can cause crashes in the runtime
Generation of the Firebase Android resource file google-services.xml from Assets/google-services.json failed. If you have not included a valid Firebase Android resources in your app it will fail to initialize. C:/UnityProjects/Test/Assets..\Assets\Firebase\Editor\generate_xml_from_google_services_json.exe -i "Assets/google-services.json" -l. Microsoft.VC90.CRT.manifest could not be extracted! You can start to diagnose this issue by executing "C:/UnityProjects/Test/Assets..\Assets\Firebase\Editor\generate_xml_from_google_services_json.exe -i "Assets/google-services.json" -l." from the command line. UnityEngine.Debug:LogError(Object) Firebase.Editor.GenerateXmlFromGoogleServicesJson:RunResourceGenerator(String, String, Boolean) (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:508) Firebase.Editor.GenerateXmlFromGoogleServicesJson:ReadBundleIds(String) (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:369) Firebase.Editor.GenerateXmlFromGoogleServicesJson:UpdateConfigFileDirectory() (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:261) Firebase.Editor.GenerateXmlFromGoogleServicesJson:CheckConfiguration() (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:223) Firebase.Editor.GenerateXmlFromGoogleServicesJson:.cctor() (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:83) UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()
I'd like to add this;
public void Start() {
Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived;
Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived;
}
but due to errors, I get errors on the OnTokenReceived and OnMessageReceived parts.
Do these have problems with google-services.json created with Firebase for applications? Anyone please solve me.
Upvotes: 3
Views: 10798
Reputation: 3597
Whenever Firebase.Editor.GenerateXMLFromGoogleServicesJson.* is missing, it's because Unity won't load it in, or has been instructed not to. Check this by clicking on Assets/Firebase/Editor/Firebase.Editor and make sure the "Editor" checkbox is on. If you changed it, hit apply, close Unity, reopen it. That may throw some errors as it figures itself out. Close, reopen it and all should be well. Binding and unbinding dll's has some complexity to it, so I always close Unity after messing with assembly dependencies.
Upvotes: 0
Reputation: 80
Check your Project Settings > IOS. Make sure the .NET is 4.X not 3. https://docs.unity3d.com/Manual/ScriptingRuntimeUpgrade.html
Upvotes: 3
Reputation: 1
I ran into this problem with a freshly created project. The project was targeting Android and I was loading the dotnet4 version of the assembly. I switched to the dotnet3 version and it fixed the issue. I noticed that the Script Runtime Version targets .NET 3.5 Equivalent by default. I'm brand new to Unity, so I'm not sure if that's the issue.
Upvotes: 0
Reputation: 1
I was facing the same error and find an answer from the Firebase's Github. Here is the post from the Github:
All "Unloading the assembly" does is unload the DLL from the app domain (i.e Unity's process) then disable the platform targeting options. So what you'll need to do is select the unloaded DLL(s) and in the plugin inspector tick the platform check boxes to re-enable them for the appropriate platform.
We typically follow the pattern to enable target platforms:
Firebase/*.dll
: Target Android, Editor, Standalone - with the exception ofFIrebase.Database.dll
Firebase/Firebase.Database.dll
: Target Android-onlyFirebase/iOS/*.dll
: Target iOSFirebase/Mono/Firebase.Database.dll
: Target Editor, Standalone
Here is the link: https://github.com/firebase/quickstart-unity/issues/256
Hope it helps.
Upvotes: 0