[英]Unity and Firebase Database 7.0.2 : Fallback handler could not load library
I've just integrated Firebase Auth within my project which works great.我刚刚在我的项目中集成了 Firebase Auth,效果很好。 Database is created on the Firebase portal.
数据库是在 Firebase 门户网站上创建的。
After integrating Firebase Database (which for some obscure reason doesnt show within the Unity Package Manager), when calling database = FirebaseDatabase.DefaultInstance;
集成 Firebase 数据库后(由于某些不明原因未在 Unity Package 管理器中显示),当调用
database = FirebaseDatabase.DefaultInstance;
at start, the editor freezes.开始时,编辑器冻结。
I checked the Editor log which ends with what I've copy pasted below.我检查了以我在下面复制粘贴的内容结尾的编辑器日志。 I've seen some posts here about it being an issue with firebase 6.10 but I'm on 7.0.2 here.
我在这里看到了一些关于 firebase 6.10 的问题的帖子,但我在这里使用的是 7.0.2。 Wondering if you all had any ideas?
想知道大家有没有什么想法?
Editor log:编辑日志:
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle.dylib Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle.so Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle Loaded scene 'Temp/__Backupscenes/0.backup'后备处理程序无法加载库/Applications/Unity/Hub/Editor/2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle 后备处理程序无法加载库/Applications/Unity/Hub/Editor/2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle.dylib 后备处理程序无法加载库/Applications/Unity /Hub/Editor/2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle.so 回退处理程序无法加载库/Applications/Unity/Hub/Editor /2019.4.11f1/Unity.app/Contents/Frameworks/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-7_0_2.bundle 加载场景'Temp/__Backupscenes/0.backup'
Edit#1: First of all thank you both for your lengthy answers.编辑#1:首先感谢你们的冗长回答。 I will try to reimport the bundle files within the project and report back to you.
我将尝试在项目中重新导入捆绑文件并向您报告。 I should note that the path that is listed in the editor log actually doesnt exist within my Unity.app package content.
我应该注意到,编辑器日志中列出的路径实际上并不存在于我的 Unity.app package 内容中。 It finds Contents and Frameworks, but then Mono doesnt exist... After adding CakeCommander's registry to my Packages/Manifest.json I finally managed to have the Google LLC section of the package manager and re-import both Realtime Database and Auth from there, so that's good.
它找到了内容和框架,但是 Mono 不存在......在将 CakeCommander 的注册表添加到我的 Packages/Manifest.json 之后,我终于设法拥有 package 管理器的 Google LLC 部分,并从那里重新导入实时数据库和 Auth,所以这很好。 I should note as well that now all of the SDK's folders exist in the Packages folder and nothing's in Assets anymore.
我还应该注意到,现在所有 SDK 的文件夹都存在于 Packages 文件夹中,而 Assets 中不再有任何内容。 I'm not using any version control for the time being.
我暂时没有使用任何版本控制。
You might need to add The Google game package registry to your Packages/Manifest.json file your Unity Project.您可能需要将 Google 游戏 package 注册表添加到您的 Packages/Manifest.json 文件您的 Unity 项目中。
This should look like:这应该看起来像:
{
"scopedRegistries": [
{
"name": "Game Package Registry by Google",
"url": "https://unityregistry-pa.googleapis.com",
"scopes": [
"com.google"
]
}
],
"dependencies": {
...
}
}
You will need to restart Unity, for it to recognise this change.您需要重新启动 Unity,它才能识别此更改。
I'd suggest reimporting via the package Manager in case of potential misconfiguration.我建议通过 package 管理器重新导入,以防可能出现配置错误。
I'll start with that this looks like it's an Editor only issue as you've posted it (I wouldn't be surprised if it occurred on your device).我将从您发布的这看起来像是一个编辑器唯一的问题开始(如果它发生在您的设备上,我不会感到惊讶)。 To break down this specific log, the Firebase Unity SDK consists of three parts:
为了分解这个特定的日志,Firebase Unity SDK 由三部分组成:
It looks like layer 3 is missing, at least on Desktop.看起来缺少第 3 层,至少在桌面上是这样。 The files that are missing are
.bundle
files which are basically shared libraries for macOS.缺少的文件是
.bundle
文件,它们基本上是 macOS 的共享库。 So one of three things could be happening:因此,可能会发生以下三件事之一:
MacOS Catalina (and newer) have really strict protections over what can and can't run. MacOS Catalina(和更新版本)对可以运行和不能运行的内容有非常严格的保护。 You may need to explicitly allow the
.bundle
files for MacOS for the Unity Editor to connect with the Firebase libraries.您可能需要明确允许 MacOS 的
.bundle
文件,以便 Unity 编辑器与 Firebase 库连接。 I've recorded a video about this , but the general gist is that you need to re-install the Firebase plugin, run Unity (you should get a security popup), dismiss the popup without deleting anything, then allowing Firebase in your computer's security settings.我已经录制了一个关于这个的视频,但一般的要点是你需要重新安装 Firebase 插件,运行 Unity(你应该得到一个安全弹出窗口),关闭弹出窗口而不删除任何内容,然后允许 Firebase 在你的计算机的安全设置。
you've excluded the.bundle files from your project.您已从项目中排除了 .bundle 文件。 Either when importing the SDK or when adding your project to source control (sometimes these are excluded as "build artifacts").
在导入 SDK 或将项目添加到源代码控制时(有时这些被排除在“构建工件”之外)。 In order to test Firebase in editor on your mac, you will need to include this.bundle file.
为了在 Mac 上的编辑器中测试 Firebase,您需要包含 this.bundle 文件。 This might be as simple as re-importing the
FirebaseDatabase.unitypackage
and ensuring that FirebaseCppDatabase.bundle
and related .bundle
files are included:这可能就像重新导入
FirebaseDatabase.unitypackage
并确保包含FirebaseCppDatabase.bundle
和相关的.bundle
文件一样简单:
Note that if you did clone your project from source control, you will want to find your exclude rules and ensure that bundle files get committed.请注意,如果您确实从源代码管理中克隆了您的项目,您将需要找到您的排除规则并确保提交捆绑文件。
.bundle
files might not be associated with the Editor build target..bundle
文件可能未与编辑器构建目标关联。 This usually occurs either when folks are tweaking the build system (ex: experimenting with .asmdef
files) or are gun-shy about including .meta
files in their commits..asmdef
文件)或对在提交中包含.meta
文件感到害羞的时候。 You'll want to make sure that the .bundle
files are included in the "Editor" builds to run in Editor and "Standalone" if you ever want to spin off a macOS native build of your game with Unity:.bundle
文件包含在“编辑器”构建中以在编辑器和“独立”中运行: Note that @CakeCommander's suggestion may fix your issue as well.请注意,@CakeCommander 的建议也可以解决您的问题。 The PackageManager installs the Firebase SDK next to rather than inside your
Assets/
directory, and Unity will know how to fetch this on each machine when needed. PackageManager 将 Firebase SDK 安装在
Assets/
目录旁边而不是内部,Unity 将知道如何在需要时在每台机器上获取它。 It's unlikely that any developers or version control software will be able to break the install.任何开发人员或版本控制软件都不太可能破坏安装。 I will note that the External Dependency Manager for Unity used to automatically migrate packages to the package manager, but does not anymore - so I might wait for that feature to be reimplemented before messing with the package registry directly but it could also be your easiest path forward.
我会注意到 Unity 的外部依赖管理器用于自动将包迁移到 package 管理器,但现在不再 - 所以我可能会等待重新实现该功能,然后再直接与 package 注册表混淆,但这也可能是您最简单的路径向前。
For a reason for our issue: we used the Firebase SDK too early before the SDK was initialised.出于我们问题的原因:我们在 SDK 初始化之前过早地使用了 Firebase SDK。
For example: send a Firebase event in the splash screen when the Firebase Analytic SDK has not been initiated.例如:在 Firebase 解析 SDK 还没有启动时,在启动画面发送 Firebase 事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.