【问题标题】:Unity + Firebase: Unable to load DLL 'FirebaseCppApp-10_3_0'Unity + Firebase:无法加载 DLL \'FirebaseCppApp-10_3_0\'
【发布时间】:2023-01-23 00:54:03
【问题描述】:

我正在使用 Unity 2021.3.11f1 为 Android 游戏实施 Firebase 10.3.0 Analytics + Crashlytics。 在 Google 仪表板中没有显示任何内容的几次测试之后,我认为 Firebase 初始化有问题。

当我在我的 Android 设备上启动游戏时,这是在 logcat 中看到的第一件事:

01-05 15:51:45.078 32211  2657 E Unity   : DllNotFoundException: Unable to load DLL 'FirebaseCppApp-10_3_0'. Tried the load the following dynamic libraries: Unable to load dynamic library 'FirebaseCppApp-10_3_0' because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = dlopen failed: library "FirebaseCppApp-10_3_0" not found
01-05 15:51:45.078 32211  2657 E Unity   :   at Firebase.AppUtilPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_AppUtil (Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate applicationDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate arithmeticDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate divideByZeroDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate indexOutOfRangeDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidCastDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidOperationDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+ExceptionDelegate ioDelegate, Firebase.AppUtilPINVOKE+SWIGExceptionHelper+E

这是我的具有依赖项的 Android 库的样子: (注意:此时我尝试安装 Firebase 9.6.0,这就是为什么这里没有说 10.3.0)

([rootProject] + (rootProject.subprojects as List)).each { project ->
    project.repositories {
        def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
        maven {
            url "https://maven.google.com"
        }
        maven {
            url (unityProjectPath + "/Assets/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:18, Assets/Firebase/Editor/AppDependencies.xml:22, Assets/Firebase/Editor/CrashlyticsDependencies.xml:20
        }
        mavenLocal()
        mavenCentral()
    }
}
dependencies {
    implementation 'com.google.android.gms:play-services-base:18.1.0' // Assets/Firebase/Editor/AppDependencies.xml:17
    implementation 'com.google.android.play:asset-delivery:2.0.0' // Assets/GooglePlayPlugins/com.google.play.assetdelivery/Editor/Dependencies.xml:3
    implementation 'com.google.android.play:core-common:2.0.0' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3
    implementation 'com.google.firebase:firebase-analytics:21.1.1' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:15
    implementation 'com.google.firebase:firebase-analytics-unity:9.6.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
    implementation 'com.google.firebase:firebase-app-unity:9.6.0' // Assets/Firebase/Editor/AppDependencies.xml:22
    implementation 'com.google.firebase:firebase-common:20.1.2' // Assets/Firebase/Editor/AppDependencies.xml:13
    implementation 'com.google.firebase:firebase-crashlytics-ndk:18.2.13' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:13
    implementation 'com.google.firebase:firebase-crashlytics-unity:9.6.0' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:20
}
android {
  packagingOptions {
      exclude ('/lib/armeabi/*' + '*')
      exclude ('/lib/armeabi-v7a/*' + '*')
      exclude ('/lib/mips/*' + '*')
      exclude ('/lib/mips64/*' + '*')
      exclude ('/lib/x86/*' + '*')
      exclude ('/lib/x86_64/*' + '*')
  }

我运行通常的“CheckAndFixDependencies”并且在此期间没有收到任何错误。我之前也曾在另一个项目中成功地使它正常工作,但无论我做什么,由于找不到 DLL,firebase 的“核心”应用程序似乎都无法启动。

我尝试了 Firebase SDK 10.3.0 和 9.6.0,结果相同。

当我发现它声称在 Unity 中丢失的 DLL (Assets/Firebase/Plugins/x86_64/FirebaseCppApp-9_6_0.dll) 时,它被包含在每个平台、编辑器和独立平台中。

我已经强迫了无数次依赖解决,但没有运气。

我尝试禁用目标架构 ARMv7(因为我看到有人在另一篇关于此的帖子中建议这样做)。不幸的是,也没有帮助。

我目前正在使用 apk 进行测试,因此我不必通过 aab atm 进行工作,但我真的怀疑这会导致 Firebase 问题。

我是否遗漏了一些非常明显的东西/在这里失明了?

【问题讨论】:

  • 你能检查一下你是否有同一个 dll 的不同版本吗?您还可以检查 dll 导入设置以查看它们是否按预期设置。

标签: c# android firebase unity3d crashlytics


【解决方案1】:

我有同样的问题。我会尝试很多次,但没有用。 在第二天结束时,我尝试创建新的空项目并添加 https://developers.google.com/unity/archive#firebase_app_core

在包管理器中作为 tarball tgz 文件:

  1. 外部依赖 tgz
  2. firebase 应用程序(核心)tgz
  3. 对我来说它是 firebase 分析,对你来说它是另一个 firebase tgz

    在我的情况下,那些 tgz 必须是相同的版本,首先安装 10.3 它是行不通的。 其次,我下载 9.6 tgz 文件。它的工作。

    但我在控制台中遇到新错误:Firebase 配置中未设置数据库 URL。

    它在 firebase 帐户中解决了你需要创建实时数据库,并下载新的 google-services.json。然后在 Unity 中删除旧的 google-services.json 并清理 AssetsStreamingAssets 文件夹。导入新的 google-services.json。它的工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-08-08
    • 1970-01-01
    • 1970-01-01
    • 2017-06-26
    • 2012-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多