首页 > 解决方案 > Firebase Unity Android:在您的项目中找不到 google-services.json 文件

问题描述

我正在尝试将 Firebase 添加到我的 Unity 项目中,但不知何故它一直给我一个恼人的错误。

我尝试使用generate_xml_from_google_services_json.exe自己,但这并没有解决问题。我还尝试编辑generate_xml_from_google_services_json.pypython 脚本以更改默认位置(设置为“正常”android 应用程序路径),但这也不起作用。

我完全按照Firebase 文档中的步骤操作,并将 google-services.json fie 粘贴到文件夹的根目录中,assets但它仍然给我以下错误:

No google-services.json files found in your project so it is not possible to 

generate Firebase Android resources file google-services.xml.
Building without Firebase Android resources (google-services.xml) will result in an app that will fail to initialize.

To resolve this problem, follow the setup instructions at https://firebase.google.com/docs/unity/setup#setup_for_android
UnityEngine.Debug:LogError(Object)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:LogErrorIfEnabled(String)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:FindGoogleServicesFile(ConfigFileType, String, FindGoogleServicesFileMode, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:ReadProjectFields()
Firebase.Editor.SettingsWindow:OnFocus()
UnityEditor.DockArea:OnEnable()

以前有没有人遇到过这个错误(因为我找不到其他人有这个问题),你是如何解决的?

标签: androidfirebaseunity3dgoogle-play-services

解决方案


下载配置文件

获取 Android 应用的配置文件 要下载 Android 应用的配置文件:

登录 Firebase 并打开您的项目。单击设置图标并选择项目设置。在您的应用程序卡中,从列表中选择您需要配置文件的应用程序的包名称。单击 google-services.json。

将 SDK 添加到您的应用

将 GoogleService-Info.plist 文件添加到项目中。

导航到 Project 窗口中的 Assets 文件夹。将从 Firebase 控制台下载的 GoogleService-Info.plist 拖到文件夹中。注意:GoogleService-Info.plist 可以放在 Assets 文件夹下的任何位置。


推荐阅读