【问题标题】:Unity Generation of the Firebase Android resource file google-services.xml from Assets/GoogleService-Info.plist failed从 Assets/GoogleService-Info.plist 统一生成 Firebase Android 资源文件 google-services.xml 失败
【发布时间】:2021-03-16 18:50:05
【问题描述】:

我想在 Unity 2020.1.14 中设置 Firebase。

我将 GoogleService-Info.plist 下载到我的资产文件夹中,并在 Firebase 控制台中设置了一个项目。

但一旦我导入 FirebaseAnalytics 7.0 包,我就会收到此错误:

Generation of the Firebase Android resource file google-services.xml from Assets/GoogleService-Info.plist failed.
If you have not included a valid Firebase Android resources in your app it will fail to initialize.

"python" "/Users/joerg/Projekte/UnityTest/FirebaseTest2012042/Assets/Firebase/Editor/generate_xml_from_google_services_json.py" -i "Assets/GoogleService-Info.plist" -l --plist

Could not find key in plist file: [DATABASE_URL]

如何在 GoogleService-Info.plist 中设置 [DATABASE_URL]?

谢谢 约尔格

【问题讨论】:

  • 只是补充一下@iTouch 所说的话:8. 如果您不想被计费,可以从 Firebase 控制台中删除实时数据库

标签: android ios firebase unity3d plist


【解决方案1】:

这真是令人沮丧。 original setup tutorial 上没有提到这个问题。我假设更多的人会遇到这个问题。所以这里是解决方案:

  1. 转到Firebase Console
  2. 选择您的项目
  3. 转到“实时数据库”
  4. 创建实时数据库

数据库创建后。

  1. 转到“项目设置”
  2. 下载google-services.jsonGoogleService-Info.plist
  3. 在您的 Unity 项目中替换这些文件。 (这些文件应该在 Assets 文件夹中,或者如果您创建了 Data 文件夹,那么您可以在那里找到它们。)

在新生成的文件中有一个"firebase_url":。以前缺少的。现在应该可以修复此特定错误消息。

【讨论】:

  • 感谢您的详细说明。或许值得注意:"firebase_url" 在 google-services.json 中,但在 GoogleService-Info.plist 中,键是 "DATABASE_URL"
【解决方案2】:

好的,我找到了解决方案:我只需要在 Firebase 控制台中设置一个数据库,然后将 url 写入 plist 文件。 Google 教程中没有提到这一点。

【讨论】:

    【解决方案3】:

    简单的解决方案,只需添加这些行:

    <key>DATABASE_URL</key>
    <string>https://unexisting.fake.database.firebaseio.com</string>
    

    附言我不建议启用数据库服务,因为它是付费的。如果出于某种原因,某些插件会尝试以某种方式使用它,您将需要付费。我不使用 Google 提供的那些很棒的付费服务的唯一原因是它们只是 POST PAID,无法设置限制(除非您自己编写了一些复杂的脚本,这些脚本将实时运行并在达到一定限制后关闭服务) .有很多开发者的故事是由于脚本中的一些错误而以 5-10k 的账单醒来。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-17
      • 2020-01-07
      • 1970-01-01
      • 2017-04-23
      • 1970-01-01
      • 2017-03-24
      • 2016-03-23
      相关资源
      最近更新 更多