簡體   English   中英

Unity + Firebase:無法加載 DLL 'FirebaseCppApp-10_3_0'

[英]Unity + Firebase: Unable to load DLL 'FirebaseCppApp-10_3_0'

我正在使用 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”並且在此期間沒有收到任何錯誤。 我之前也設法在另一個項目中成功地完成了這項工作,但無論我做什么,firebase 的“核心”應用程序似乎都無法啟動,因為無法找到 DLL。

我嘗試了 Firebase SDK 10.3.0 和 9.6.0,結果相同。

當我發現它聲稱在 Unity (Assets/Firebase/Plugins/x86_64/FirebaseCppApp-9_6_0.dll) 中丟失的 DLL 時,它被包含在每個平台、編輯器和獨立平台中。

我已經強迫了無數次依賴解決,但沒有運氣。

我嘗試禁用目標架構 ARMv7(因為我看到有人在另一篇關於此的帖子中建議這樣做)。 不幸的是,也沒有幫助。

我目前正在使用 apk 進行測試,因此我不必通過 aab atm 進行工作,但我真的懷疑這會導致 Firebase 問題。

我是否遺漏了一些非常明顯的東西/在這里失明了?

我有同樣的問題。 我會嘗試很多次,但沒有用。 在第二天結束時,我嘗試創建新的空項目並從https://developers.google.com/unity/archive#firebase_app_core添加

在 package 管理器中作為 tarball tgz 文件:

  1. 外部依賴 tgz
  2. firebase 應用程序(核心)tgz
  3. 對我來說是 firebase 對你來說是另一個分析 firebase tgz

在我的情況下,那些 tgz 必須是相同的版本,首先安裝 10.3 它是行不通的。 其次,我下載 9.6 tgz 文件。 它的工作。

但是我在控制台中有新錯誤:數據庫 URL 未在 Firebase 配置中設置。

它在firebase帳戶中解決了您需要創建實時數據庫,並下載了新的google-services.json。 然后在 Unity 中刪除舊的 google-services.json 並清理 Assets\StreamingAssets 文件夾。 導入新的 google-services.json。 它的工作。

然后我嘗試在我的工作項目中。 我刪除了所有 firebase sdk 文件夾並做了同樣的事情。 它工作正常!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM