Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity 2021 Editor crash on startup with 8.5.0 Firebase SDK #89

Closed
samskivert opened this issue Nov 8, 2021 · 6 comments
Closed

Unity 2021 Editor crash on startup with 8.5.0 Firebase SDK #89

samskivert opened this issue Nov 8, 2021 · 6 comments

Comments

@samskivert
Copy link

A skeleton project set up with Firebase App and Firebase Auth crashes Unity 2021.2 immediately on startup. The relevant error from the Editor.log is thus:

* Assertion at loader.c:345, condition `is_ok (error)' not met, function:mono_field_from_token, Could not resolve field token 0x0400001c, due to: Could not load type of field 'Firebase.Editor.GenerateXmlFromGoogleServicesJson:<>f__mg$cache0' (17) due to: Could not load file or assembly 'Google.JarResolver, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:/Users/mdb/projects/bugs/unity-2021-firebase-files/Library/PackageCache/com.google.firebase.app@25e0485ee6cf-1636337084685/Firebase/Editor/Firebase.Editor.dll type:GenerateXmlFromGoogleServicesJson member:(null)

You can clone this repo: https://github.com/samskivert/unity-2021-firebase-crash and then put the requisite .tgz files from https://developers.google.com/unity/archive into GooglePackages in the top-level directory to repro the crash:

GooglePackages/com.google.external-dependency-manager-1.2.167.tgz
GooglePackages/com.google.firebase.app-8.5.0.tgz
GooglePackages/com.google.firebase.auth-8.5.0.tgz

Notably it does not happen if the Unity SDK is added via the .unitypackage files, so something about installing the SDK via the package manager is tickling the bug.

I have not been able to devise a workaround, so it prevents us from upgrading from Unity 2020 (where it works) to Unity 2021 (where it crashes on startup).

@samskivert
Copy link
Author

samskivert commented Nov 8, 2021

FWIW if you're just making a cursory examination of the error message Google.JarResolver.dll does exist, at the right location and it is the right version. So I think the or one of its dependencies is the pertinent information here, but Mono helpfully does not tell us what downstream dependency is sticking a fork in things.

@ewnu
Copy link

ewnu commented Nov 30, 2021

still suffers from this issue in 8.6.2

@ryokomy
Copy link

ryokomy commented Dec 8, 2021

I found this happens in the following versions as well

  • 8.4.0
  • 7.2.0

@softshadedev
Copy link

Hello comrades!
Installed Unity version 2021.2.6
Updated external-dependency-manager to version 1.2.168
Added package firebase-app-8.6.2

The editor didn't crash!

@samskivert
Copy link
Author

Oh great day! Christmas has come early.

It's all working for us as well. Such a tiny diff to end our woe and suffering: googlesamples/unity-jar-resolver@23a3eb7

We still have to do some small hackery to keep things working on the new Apple Silicon Macs, but that's not too painful. For anyone that turns up here later chasing down that particular rabbit, see here: https://github.com/aroman/firebase-unity-applesilicon

I'm going to help out the Firebase team and call this closed. Upgrading EDM to 1.2.168 is the key fix.

@samskivert
Copy link
Author

A few more details on the Apple Silicon workaround: using the .tgz files in conjunction with ASi just means installing the Firebase packages as normal via the package manager and then creating a directory in your Assets somewhere (like Assets/Plugins/Firebase but it can be called whatever you like) that has the arm64 directory from the github project above. Unity will then complain that there are two copies of the Firebase libraries installed, but it will still correctly use the arm64 versions when running on Apple Silicon Macs.

Hopefully Google will eventually ship arm64 libraries as well for Firebase and all the hackery can end.

@firebase firebase locked and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants