quickstart-unity: InitializationException: Crashlytics initialization failed. Could not find Crashlytics initializer.

Please fill in the following fields:

Unity editor version: 2018.4.19f1 Firebase Unity SDK version: 6.13.0 Firebase plugins in use (Auth, Database, etc.): Core, Analytics, Crashlytics, RemoteConfig Additional SDKs you are using (Facebook, AdMob, etc.): Admob Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows Platform you are targeting (iOS, Android, and/or desktop): Android Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Please describe the issue here:

Upgraded project from 6.9.0 which worked. Using firebase core, analytics, Crashlytics, RemoteConfig from the package manager.

As a workaround I tried manually installing it but here I get a editor warning about crashlytics instead.

This is the log from the package manager based install:

2020-03-27 10:56:07.106 1718-1855/? I/Unity: Firebase Analytics API Initializing
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-03-27 10:56:07.107 1718-1855/? I/Unity: analytics API Initialized
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-03-27 10:56:07.107 1718-1855/? I/Unity: Remote Config API Initialized
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-03-27 10:56:07.160 1718-1855/? I/Unity: Firebase Analytics API Initializing
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-03-27 10:56:07.161 1718-1855/? I/Unity: analytics API Initialized
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-03-27 10:56:07.167 1718-1855/? I/Unity: Remote Config API Initialized
     
    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
2020-03-27 10:56:07.179 1718-1855/? E/Unity: InitializationException: Crashlytics initialization failed. Could not find Crashlytics initializer.
      at Firebase.FirebaseApp.InitializeCrashlyticsIfPresent () [0x00000] in <00000000000000000000000000000000>:0 
      at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x00000] in <00000000000000000000000000000000>:0 
      at MB.Unity.SafeBoot.Items.SafeBootFirebase.TryCheckFirebaseTaskCompleted (System.Threading.Tasks.Task`1[TResult] task) [0x00000] in <00000000000000000000000000000000>:0 
      at MB.Unity.SafeBoot.Items.SafeBootFirebase.OnFirebaseCheckWait () [0x00000] in <00000000000000000000000000000000>:0 
      at MB.Unity.SafeBoot.Items.SafeBootFirebase.Process () [0x00000] in <00000000000000000000000000000000>:0 
      at MB.Unity.SafeBoot.SafeBootManager.Process () [0x00000] in <00000000000000000000000000000000>:0 
      at MB.Unity.SafeBoot.SafeBootManager.Update (System.Single deltaTime) [0x00000] in <00000000000000000000000000000000>:0 
      at M

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

Unfortunately no. But two projects that worked with 6.9.0 produce this error.

What’s the issue repro rate? 100%

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 32 (2 by maintainers)

Most upvoted comments

I have now made it work for myself, with or without Code Stripping 🎉 I added an XML file called link.xml to my project’s root directory and added this code to it:

// link.xml
<linker>
   
  <assembly fullname="Firebase.Crashlytics" ignoreIfMissing="1">
    <namespace fullname="Firebase.Crashlytics" preserve="all"/>
  </assembly>

  <assembly fullname="Firebase.App" ignoreIfMissing="1">
    <namespace fullname="Firebase.App" preserve="all"/>
  </assembly>
  
</linker>

Somehow, either the Crashlytics or the Firebase App were missing. It might have something to do with what the documentation says:

Note that link.xml files are not supported inside packages, but you can reference package assemblies from non-package link.xml files.

If this made it work for you too, do notify me, so I can be sure this was the problem! 🙂

File com.google.firebase.crashlytics@6.14.0/Firebase/Plugins/Crashlytics/link.xml is ignored by Unity, and it is critical in order to make it work on games that use code stripping.

Link.xml files are ignored on UPM packages (read more).

Ideally, Crashlytics will update their code to include [Preserve] attributes on critical code. (read more).

Thanks @AnnMic, I also installed from package manager and the link.xml solved the issue. Just a couple of clarifications that may be obvious but I thought worth mentioning:

  1. The link.xml should be in the project’s assets folder.
  2. The first line (// link.xml) in the above code snippet shouldn’t be copy-pasted into the XML.

Had the same issue as well. Installed from package manager. version 6.14 did not resolve the issue. The link.xml file mentioned above solved the issue.

Hi @NielsGroep,

Yes, a fix for the Android version was released with 6.15. The team wasn’t able to reproduce the iOS issue, but it may be fixed as well.

I’m going to remove the bug tag and request more information. Please confirm if the fix successfully solves the issue and respond here with whatever results you get. Thanks!

Seeing in the 1.6.15 release notes that it should be fixed now? https://firebase.google.com/support/release-notes/unity “Prevented stripping of Crashlytics code by the UnityLinker.”

Does anyone know if we should also add the other firebase packages used to the link.xml file? For example: analytics and messaging

I added remote config and analytics to project, but didn’t add them to link.xml and everything works. I think it’s only needed for crashlyltics.

Using *.unitypackage instead of Package Manager helped in my case.

I have now made it work for myself, with or without Code Stripping 🎉 I added an XML file called link.xml to my project’s root directory and added this code to it:

// link.xml
<linker>
   
  <assembly fullname="Firebase.Crashlytics" ignoreIfMissing="1">
    <namespace fullname="Firebase.Crashlytics" preserve="all"/>
  </assembly>

  <assembly fullname="Firebase.App" ignoreIfMissing="1">
    <namespace fullname="Firebase.App" preserve="all"/>
  </assembly>
  
</linker>

Somehow, either the Crashlytics or the Firebase App were missing. It might have something to do with what the documentation says:

Note that link.xml files are not supported inside packages, but you can reference package assemblies from non-package link.xml files.

If this made it work for you too, do notify me, so I can be sure this was the problem! 🙂

Fixed the issue for me too. Thank you 😃