quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

Unloading broken assembly - unity 2018.2.17f1 and firebase 5.4.2

Open michaeleconomy opened this issue 8 years ago • 15 comments

I just tried importing this package and it's not working.

Unloading broken assembly Assets/Firebase/Plugins/Firebase.App.dll, this assembly can cause crashes in the runtime Unloading broken assembly Assets/Firebase/Plugins/Firebase.Analytics.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

there seems to be some bug in unity preventing a more detailed error message: https://issuetracker.unity3d.com/issues/unloading-broken-assembly-error-message-provides-insufficient-information

michaeleconomy avatar Nov 28 '18 20:11 michaeleconomy

guessing it's not just me: https://stackoverflow.com/questions/53519283/when-installing-firebase-on-unity-i-get-an-error-unloading-broken-assembly https://stackoverflow.com/questions/53401204/unloading-broken-assembly-assets-firebase-plugins-mono-firebase-database-dll-th

michaeleconomy avatar Nov 28 '18 20:11 michaeleconomy

I got the same error after importing Facebook SDK. The dependencies were resolved. Created APK. But, the APK refused to get installed.

0bytedna avatar Nov 30 '18 03:11 0bytedna

In my case APK crashed instantly with that version (when app loads on mobile), No errors in log, just a pure crash. I use Facebook SDK (latest). Had to move back to older Firebase version and wasted a full day and got a bonus headache on this.. Don't they test before releasing???

dman103 avatar Nov 30 '18 14:11 dman103

@ColorTwist we do test prior to releasing. Unity constantly offers the challenge of releasing new versions with unexpected changes in behavior.

Everyone, you shouldn't need to rollback the Firebase version .. re-enabling the platform targeting for each unloaded DLL should (assuming a new Unity release has new problems) resolve the issue.

stewartmiles avatar Nov 30 '18 15:11 stewartmiles

Thanks for the response Stewart! Supporting this does sound challenging.

“re-enabling the platform targeting for each unloaded DLL should (assuming a new Unity release has new problems) resolve the issue.”

What does this mean, and how do i do it?

michaeleconomy avatar Nov 30 '18 16:11 michaeleconomy

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 of FIrebase.Database.dll
  • Firebase/Firebase.Database.dll : Target Android-only
  • Firebase/iOS/*.dll : Target iOS
  • Firebase/Mono/Firebase.Database.dll : Target Editor, Standalone

stewartmiles avatar Nov 30 '18 16:11 stewartmiles

I re-enable the target platforms as stated but it did not work. Any workarounds?

angielle avatar Dec 06 '18 03:12 angielle

I have the same problem.. Any one find the solution?

rahat10120141 avatar Dec 07 '18 10:12 rahat10120141

Any chance someone has a way to reproduce this failure?

Here's what I did without running into problems.

Firstly:

  • On MacOS 10.13.6
  • Installed Unity 2018.2.17f1
  • Downloaded samples from this repo
  • Opened the database sample project (target platform was desktop, scripting runtime version was .NET 3.x)
  • Downloaded and unzipped Firebase Unity SDK 5.4.3
  • Imported dotnet3/FirebaseDatabase.unitypackage into the sample project from the Firebase Unity SDK directory.
  • Waited for compilation to complete
  • Selected Firebase/Sample/Database/MainScene.unity
  • Pressed run in the editor

Also I tried:

  • On MacOS 10.13.6
  • Installed Unity 2018.2.17f1
  • Downloaded samples from this repo
  • Opened the database sample project
  • Switched the scripting runtime to .NET 4.6 (required Unity restart)
  • Downloaded and unzipped Firebase Unity SDK 5.4.3
  • Imported dotnet4/FirebaseDatabase.unitypackage into the sample project from the Firebase Unity SDK directory.
  • Waited for compilation to complete
  • Selected Firebase/Sample/Database/MainScene.unity
  • Pressed run in the editor

stewartmiles avatar Dec 07 '18 17:12 stewartmiles

Any updates on this? Did anyone manage to reproduce the failure?

stewartmiles avatar Dec 18 '18 17:12 stewartmiles

Sorry for not following up. UNfortunately i just used unity-analytics instead for my project.

However, on a seperate project, with a seperate library i ran into a simular issue with unity 2018.2.17

this was in the patch notes for 2018.2.18: Editor: Fixed issue with precompiled managed assemblies (.dlls) in the Assets folder getting loaded twice on startup, causing two InitializeOnLoad calls where Unity API calls such as AssetDatabase.LoadAssetAtPath would fail in the first InitializeOnLoad. Now there is only one first InitializeOnLoad call and Unity APIs work as expected. (1060352)

Could be related?

Thanks for investigating Stewart, sorry for the lack of followthrough.

michaeleconomy avatar Dec 23 '18 00:12 michaeleconomy

Selected Firebase/Sample/Database/MainScene.unity

Where to find this?

deertwigarts avatar Dec 31 '18 13:12 deertwigarts

I think people are encountering this issue because they are mismatching their Unity c# scripting backend and the dotnet version of the Firebase package.

If Unity's scripting backend is set to 3.x, you need to use the packages within the dotnet3 folder.

If Unity's backend is 4.x, then you can use the dotnet4 folder.

The steps listed on the Firebase setup instructions indicate that you can use the dotnet4 folder with Unity 2017, which is true only if you set the scripting backend to 4.x (experimental). If you want to keep using the 3.x backend, then you have to use dotnet3 packages.

tomkillen avatar Jan 05 '19 09:01 tomkillen

Hey tomkillen, I had the same issue and re-importing the Firebase package using dotnet3 resolved my issue. Thanks for catching that!

junievi avatar Jan 10 '19 18:01 junievi

I think people are encountering this issue because they are mismatching their Unity c# scripting backend and the dotnet version of the Firebase package.

If Unity's scripting backend is set to 3.x, you need to use the packages within the dotnet3 folder.

If Unity's backend is 4.x, then you can use the dotnet4 folder.

The steps listed on the Firebase setup instructions indicate that you can use the dotnet4 folder with Unity 2017, which is true only if you set the scripting backend to 4.x (experimental). If you want to keep using the 3.x backend, then you have to use dotnet3 packages.

This fixed the issue for me as well. See this post for more info: https://stackoverflow.com/a/54029970/6080254

brunomonteirosud avatar Feb 05 '19 05:02 brunomonteirosud