firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
200 stars 33 forks source link

[Bug] DllNotFoundException: Unable to load DLL 'FirebaseCppApp-11_4_0' #856

Closed johntitor08 closed 1 month ago

johntitor08 commented 10 months ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? What's the issue repro rate? (eg 100%, 1/5 etc)

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

Relevant Code:

// TODO(you): code here to reproduce the problem

Error: DllNotFoundException: Unable to load DLL 'FirebaseCppApp-11_4_0'. Tried the load the following dynamic libraries: Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE.SWIGExceptionHelper' threw an exception. Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception.

a-maurice commented 10 months ago

This is a common issue with project configuration. What platform are you running on that is getting this error? Are all the Firebase SDKs that you are using the version at 11.4.0?

Antonio-Gorisek commented 9 months ago

@johntitor08 I had this error for ANDROID and I fix it (I haven't tested it for iOS jet) DllNotFoundException: FirebaseCppApp-11_2_0 assembly: It was actually very simple for me.

1) The Firebase and ExternalDependencyManager folders must be located in the Asset folder; you should not move them elsewhere.

2) Delete the Firebase and ExternalDependencyManager folders and then install each Firebase SDK asset you need.

3) Run Force resolve. Screenshot_84

kosars commented 9 months ago

Have same error even on firebase database test project (https://github.com/firebase/quickstart-unity/tree/master/database/testapp)

@Antonio-Gorisek not worked for me

Unity editor version: 2022.3.8f1 Firebase Unity SDK version: 11.4.0 Source you installed the SDK: FirebaseDatabase.unitypackage Problematic Firebase Component: Database Other Firebase Components in use: none Additional SDKs you are using: none Platform you are using the Unity editor on: Windows Platform you are targeting: Android Scripting Runtime: tried both Mono and IL2CPP

Error: DllNotFoundException: FirebaseCppApp-11_4_0 assembly: type: member:(null) Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:4087) Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. Firebase.AppUtilPINVOKE..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:4107) Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:4817) Firebase.LogUtil..ctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:81) Firebase.LogUtil..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:37) Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. Firebase.FirebaseApp..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:2014) Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception. Firebase.Sample.Database.UIHandler.Start () (at Assets/Firebase/Sample/Database/UIHandler.cs:53)

google-oss-bot commented 9 months ago

Hey @johntitor08. 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!

johntitor08 commented 9 months ago

This is a common issue with project configuration. What platform are you running on that is getting this error? Are all the Firebase SDKs that you are using the version at 11.4.0?

webgl

Andrii-Perevoznyi commented 9 months ago

Absolutely same here! Tried all found solutions. Reinstall SDK, Force Resolve, reinstall C++ redist nothing helps. This happens for me in editor with first request on any method from Firebase library from code in runtime.

Unity editor version: 2022.3.8f1 Firebase Unity SDK version: 11.4.0 Source you installed the SDK: FirebaseAnalytics.unitypackage, FirebaseCrashlytics.unitypackage, FirebaseRemoteConfig.unitypackage, FirebaseMessaging.unitypackage Platform you are using the Unity editor on: Windows Platform you are targeting: Android

DllNotFoundException: FirebaseCppApp-11_4_0 assembly: type: member:(null) Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:4087) Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. Firebase.AppUtilPINVOKE..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:4107) Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/macos_unity/x86_64/app/swig/Firebase.App_fixed.cs:4817) Firebase.LogUtil..ctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:81) Firebase.LogUtil..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:37) Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception. Firebase.Crashlytics.Crashlytics+PlatformAccessor..cctor () (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/crashlytics/src/Crashlytics.cs:143) Rethrow as TypeInitializationException: The type initializer for 'PlatformAccessor' threw an exception. Firebase.Crashlytics.Crashlytics.set_IsCrashlyticsCollectionEnabled (System.Boolean value) (at /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/crashlytics/src/Crashlytics.cs:52) Enixan.Engine.Adapters.FirebaseCrashlyticsAdapter..ctor (Zenject.SignalBus signalBus, Enixan.Engine.Configs.IMainConfig mainConfig, Enixan.Engine.Adapters.FirebaseConnector firebaseConnector) (at Assets/EnixanEngineSubmodule/Scripts/Runtime/Adapters/Firebase/FirebaseCrashlyticsAdapter.cs:25)

Visual Studio do not see any problems with dll. All code is obtainable and higlighted.

image

On screenshot there is a line that causes DLL exception.

Help please. It happen only for me, all other teammates continue working good. Possible thing is that it started when i updated from VS 2019 to VS 2022. And installed Visual C++ redist 22. I'll check later and share the result

Andrii-Perevoznyi commented 9 months ago

Unfortunately no success with my experiments. Only one explanation i have now that my Windows version after update became to be incompatible with some of .Net things =( image image

x64

This issue appears even with empty SampleProject with: Unity 2022.3.8f1, Windows 10 enterprise LTSC (1809), Intel Core i5-6500 @ 3,2Ghz

Steps:

  1. Launch Sample 2D project in Unity 2022.3.8
  2. Add FirebaseCrashlitycs.unitypackage 11.4.0
  3. Add Simple MonoBehaviour to mainCamera on SampleScene with folowing code:
    
    public class Script : MonoBehaviour
    {
    // Start is called before the first frame update
    void Start()
    {
        Firebase.Crashlytics.IsCrashlyticsCollectionEnabled = false;
    }

}


4. Start play mode and see results.
johntitor08 commented 9 months ago

yeah... i gave up to get webgl build and publish as downloadable


Gönderen: Andrii-Perevoznyi @.> Gönderildi: 26 Eylül 2023 Salı 17:14 Kime: firebase/firebase-unity-sdk @.> Bilgi: John Titor @.>; Mention @.> Konu: Re: [firebase/firebase-unity-sdk] [Bug] DllNotFoundException: Unable to load DLL 'FirebaseCppApp-11_4_0' (Issue #856)

Unfortunately no success with my experiments. Only one option i have now that my Windows version after update becames to be incompatible with some of .Net things =(

— Reply to this email directly, view it on GitHubhttps://github.com/firebase/firebase-unity-sdk/issues/856#issuecomment-1735630855, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWW2T6C2VFVIPYMFYI4TO63X4LPMNANCNFSM6AAAAAA4K3Y2UM. You are receiving this because you were mentioned.Message ID: @.***>

Andrii-Perevoznyi commented 9 months ago

No need to make webgl build. Just wanted to make it alive in editor with Android target platform

On Wed, 27 Sept 2023, 03:06 John Titor, @.***> wrote:

yeah... i gave up to get webgl build and publish as downloadable


Gönderen: Andrii-Perevoznyi @.> Gönderildi: 26 Eylül 2023 Salı 17:14 Kime: firebase/firebase-unity-sdk @.> Bilgi: John Titor @.>; Mention @.> Konu: Re: [firebase/firebase-unity-sdk] [Bug] DllNotFoundException: Unable to load DLL 'FirebaseCppApp-11_4_0' (Issue #856)

Unfortunately no success with my experiments. Only one option i have now that my Windows version after update becames to be incompatible with some of .Net things =(

— Reply to this email directly, view it on GitHub< https://github.com/firebase/firebase-unity-sdk/issues/856#issuecomment-1735630855>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AWW2T6C2VFVIPYMFYI4TO63X4LPMNANCNFSM6AAAAAA4K3Y2UM>.

You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-unity-sdk/issues/856#issuecomment-1736510128, or unsubscribe https://github.com/notifications/unsubscribe-auth/BC2TITP5MERFVV57LSEXOBDX4N3ZBANCNFSM6AAAAAA4K3Y2UM . You are receiving this because you commented.Message ID: @.***>

Andrii-Perevoznyi commented 9 months ago

Tried on my laptop. Works perfectly. Only differences are Windows 10 Home 22H2 Processor Intel Core i7-4710HQ, 2,5GHz x64

lourenco-pedro commented 6 months ago

I don't know if anyone is still facing the same issue in the editor, but after numerous attempts, I managed to solve it by simply disabling my antivirus.

After disabling my antivirus, Firebase worked fine. I then reactivated my antivirus and created a random project in Unity. I imported the FirebaseAppCheck SDK into it, added a script that called FirebaseApp.CheckAndFixDependenciesAsync, and dragged it into the scene to play.

After completing these steps in the random project, I closed it and reopened the actual project where I was encountering the same issue.

Surprisingly, when I returned to the actual project, it was playing nicely without encountering the error anymore.

I can't guarantee that only disabling the antivirus, playing Unity Editor, and enabling it back will already solve it, but you can follow the same steps I've done

Nghidang14 commented 1 month ago

Tried on my laptop. Works perfectly. Only differences are Windows 10 Home 22H2 Processor Intel Core i7-4710HQ, 2,5GHz x64

Me too, my laptop met same error. But my team don't. I use Windows 10 core i3-4005U, 1696MHz, x64

ogix-mimura commented 1 month ago

@Nghidang14 Try this. https://github.com/firebase/firebase-unity-sdk/issues/443#issuecomment-1231976123

In my case. it solved by installation of 'c++ redistributable 2022'.

argzdev commented 1 month ago

Hey folks, it looks like everybody might have similar problems with different resolutions. Please file a new issue with your concern so that we can cater to each developer's specific issue. That said, it does look like the issue has been resolved with the proposed fixes, so I'll go ahead and close this thread.