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

Created on 27 Mar 2020  ยท  32Comments  ยท  Source: firebase/quickstart-unity

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%

closed-by-bot needs-info stale

Most helpful comment

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! ๐Ÿ™‚

All 32 comments

I have the same problem.

Unity editor version: 2018.4.18f1
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.): MaxSDK
Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac
Platform you are targeting (iOS, Android, and/or desktop): iOS
Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Please describe the issue here:
Upgraded project from 6.9.0 which worked.
iOS Build at start crashed.

CrashReporter: initialized
2020-03-27 17:21:06.880816+0400 catstower2[9709:1430152] [Crashlytics] Version 3.13.4 (143)
InitializationException: Crashlytics initialization failed. Could not find Crashlytics initializer.
  at Firebase.FirebaseApp.InitializeCrashlyticsIfPresent () [0x00000] in <00000000000000000000000000000000>:0 
  at Firebase.Crashlytics.Crashlytics+PlatformAccessor..cctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Firebase.Crashlytics.Crashlytics.set_IsCrashlyticsCollectionEnabled (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0 
tionException: Crashlytics initialization failed with an unexpected error.
  at Firebase.FirebaseApp.InitializeCrashlyticsIfPresent () [0x00000] in <00000000000000000000000000000000>:0 
  at Firebase.Crashlytics.Crashlytics+PlatformAccessor..cctor () [0x00000] in <00000000000000000000000000000000>:0 
  at Firebase.Crashlytics.Crashlytics.set_IsCrashlyticsCollectionEnabled (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0 
: The type initializer for 'Firebase.Crashlytics.Crashlytics.PlatformAccessor' threw an exception.
  at Firebase.Crashlytics.Crashlytics.set_IsCrashlyticsCollectionEnabled (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0 

I have this problem too

Using Unity editor version: 2018.4.18f1
Firebase Unity SDK version: 6.13.0

@Vahe999 @gevorgyanmp
Did you installed Firebase through Unity Package Manager as well?

@gevorgyanmp Which platform did you see the issue? Could you provide more detail about this?

I suspect that Crashlytics editor tool might failed to resolve Xcode project or AndroidManifest.xml when it is installed through Unity Package Manager. If this issue is blocking your project, I would recommend to install unitypackage version of Firebase SDK before we fix the issue.

Thank you for reporting this.
Shawn

@chkuang-g "Did you installed Firebase through Unity Package Manager as well?" -> Yes

We also are experiencing the same issue.

Unity 2018.4.18f1
JarResolver migrated to EDM4U in Package Manager
Cleaned up FireBase and JarResolver with EDM4U tool.
FireBase 6.13.0 (from 6.9.0) from Package Manager

Same error same SDK version only Unity 2018.4.20f1

Yep, UPM version doesn't initialize Crashlytics (maybe even all of Firebae) in the build.

Same issue with Unity 2019.3.7 and Firebase 6.13 from package manager

Yep, UPM version doesn't initialize Crashlytics (maybe even all of Firebae) in the build.

For us everything else works fine. Just installing the crashlytics sdk using .unitypackage

Yep, UPM version doesn't initialize Crashlytics (maybe even all of Firebae) in the build.

For us everything else works fine. Just installing the crashlytics sdk using .unitypackage

crashlytics sdk? What you talking about? Give us the link.

I have this exact problem! Unity 2019.3.3f1, IL2CPP, Firebase 6.13.0 from External Dependencies (unity-jar-resolver).

UPDATE

When I build with Engine Code Stripping, my game crashes on startup (right after splashscreen). Without it, it gives me this thread's error. Not sure if these are related.

This is the error from Android Studio's Logcat:
A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4a in tid 31582 (UnityMain), pid 31526 (company.name)

Yep, UPM version doesn't initialize Crashlytics (maybe even all of Firebae) in the build.

For us everything else works fine. Just installing the crashlytics sdk using .unitypackage

crashlytics sdk? What you talking about? Give us the link.

In the Step 4: Add Firebase Unity SDKs/Manual Install here is the link: https://firebase.google.com/docs/unity/setup

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! ๐Ÿ™‚

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 :)

Didn't work for me, same issue.

Didn't work for me as well.

Same issue here.
It would have been so much better if the firebase team would simply update the releases page with known issues such as this one. So much time is wasted for nothing... :(

Does anyone know if this was resolved with Crashlytics 6.14?

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

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.

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.

File [email protected]/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).

We've been stuck with this crashlytics issues for days. Not being able to see crashlytics reports on firebase console. What fixed this issue:

  1. Added link.xml file to root folder (Asset). Because as @tiagomartines11 mentioned, firebase adds link.xml file with PackageManager, but it's under Packages folder and it's ignored.
  2. Do not call crashlytics logs or exceptions right after firebase init. For some reason it was ignored until I added button in game when it's fully loaded. Only then was this error shown "InitializationException: Crashlytics initialization failed. Could not find Crashlytics initializer."

Also, 15mins passed until crash was shown on firebase console.

Firebase should really fix this issue. Our update was delayed for days because of this issue. This is just unacceptable..

Also, in order to see crash logs in firebase console, you need to close app after you reproduce crash and kills process. After that, enter the app again. Somewhere in firebase doc it says that reports are sent after re-entering app.

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

From the packages I use, only Crashlytics had a link.xml.
You can check your setup by looking for link.xml files in your /Library/PackageCache folder.
E.g.

แ… find Library/PackageCache -name "link.xml"
Library/PackageCache/[email protected]/Firebase/Plugins/Crashlytics/link.xml

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.

Firebase engineer here. There was indeed a bug on the Android side when using Crashlytics via the Unity Package Manager. That will be fixed in the next release.

I have not been able to reproduce the error on iOS, even with Code Stripping enabled. So I cannot confirm that a fix will be in with the next release. The error message is consistent with a failure for Firebase to be properly initialized according to the Confirm Google Play Version step of the setup instructions. Can folks who have seen this error confirm that Firebase has been initialized successfully in the continuation?

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."

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!


Hey @Unarmed1000. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!


Since there haven't been any recent updates here, I am going to close this issue.

@Unarmed1000 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

Was this page helpful?
0 / 5 - 0 ratings