Skip to content

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

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

Closed
johntitor08 opened this issue Sep 4, 2023 · 14 comments
Closed
Labels
api: core needs-attention Need Googler's attention

Comments

@johntitor08
Copy link

johntitor08 commented Sep 4, 2023

[REQUIRED] Please fill in the following fields:

  • Unity editor version: _____
  • Firebase Unity SDK version: _____
  • Source you installed the SDK: _____ (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: _____ (Auth, Database, etc.)
  • Other Firebase Components in use: _____ (Auth, Database, etc.)
  • Additional SDKs you are using: _____ (Facebook, AdMob, etc.)
  • Platform you are using the Unity editor on: _____ (Mac, Windows, or Linux)
  • Platform you are targeting: _____ (iOS, Android, and/or desktop)
  • Scripting Runtime: _____ (Mono, and/or IL2CPP)
  • Pre-built SDK from the website or open-source from this repo: _____

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

@rizafran rizafran added api: core and removed api: auth new New issue. labels Sep 5, 2023
@a-maurice a-maurice changed the title [Bug] 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. [Bug] DllNotFoundException: Unable to load DLL 'FirebaseCppApp-11_4_0' Sep 5, 2023
@a-maurice
Copy link
Collaborator

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?

@a-maurice a-maurice added needs-info Need information for the developer and removed type: question labels Sep 5, 2023
@Antonio-Gorisek
Copy link

Antonio-Gorisek commented Sep 9, 2023

@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
Copy link

kosars commented Sep 13, 2023

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 google-oss-bot added the stale Don't have recent activity label Sep 20, 2023
@google-oss-bot
Copy link

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
Copy link
Author

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

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed stale Don't have recent activity needs-info Need information for the developer labels Sep 20, 2023
@Andrii-Perevoznyi
Copy link

Andrii-Perevoznyi commented Sep 26, 2023

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
Copy link

Andrii-Perevoznyi commented Sep 26, 2023

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;
    }

}
  1. Start play mode and see results.

@johntitor08
Copy link
Author

johntitor08 commented Sep 27, 2023 via email

@Andrii-Perevoznyi
Copy link

Andrii-Perevoznyi commented Sep 27, 2023 via email

@Andrii-Perevoznyi
Copy link

Andrii-Perevoznyi commented Sep 27, 2023

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

@lourenco-pedro
Copy link

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
Copy link

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
Copy link

@Nghidang14
Try this.
#443 (comment)

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

@argzdev
Copy link

argzdev commented May 31, 2024

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.

@argzdev argzdev closed this as completed May 31, 2024
@firebase firebase locked and limited conversation to collaborators Jul 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: core needs-attention Need Googler's attention
Projects
None yet
Development

No branches or pull requests