【问题标题】:Error: File google-services.json is missing. The Google Services Plugin cannot function without it.错误:文件 google-services.json 丢失。没有它,Google 服务插件将无法运行。
【发布时间】:2016-06-17 08:00:32
【问题描述】:

我已经在我的应用程序中包含了 google-services.json 文件,但它仍然给我错误。 错误:任务 ':app:processDebugGoogleServices' 执行失败。

文件 google-services.json 丢失。没有它,Google 服务插件将无法运行。 搜索位置: C:\Users\vikas\AndroidStudioProjects\FireBaseFunctionality\app\src\debug\google-services.json C:\Users\vikas\AndroidStudioProjects\FireBaseFunctionality\app\google-services.json

【问题讨论】:

  • 您确定已将其复制到项目的根目录中吗?
  • 是的。我已经复制到应用文件夹中

标签: android json firebase


【解决方案1】:

有同样的问题 - 在教程的下一步之前构建。您必须从 firebase 网站生成和下载文件。见Error "File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it" - 晚了,但现在有人可能需要这个。

【讨论】:

    【解决方案2】:

    进入SDK管理器--> SDK工具---->安装播放服务和USB工具和存储库 我用上述方法解决了同样的问题

    或者你可以更改谷歌服务的名称 google-services.json 而不是 google-services(任意数量).json

    【讨论】:

    • 这是 2019 年可行的解决方案吗?
    【解决方案3】:

    只需在 build.gradle 中更改这一行

    compile fileTree (dir: 'libs', include: ['* .jar'])

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    【讨论】:

      【解决方案4】:

      转到用于构建应用程序的 Flutter sdk 文件夹。删除文件夹 .pub-cache 中的所有内容 现在 pub-get 并运行。

      【讨论】:

      • 在哪里可以找到 .pub-cache?!
      • 在flutter安装文件夹中。将被隐藏。
      • 谢谢,兄弟感激!
      【解决方案5】:

      有时我们会复制下载的文件并放在 app 目录中。但它改变了名称。例如 googleservices(1).json 而不是 googleservices.json。所以请确保文件名正确。

      【讨论】:

        【解决方案6】:

        对我有用的是:

        然后按照https://console.firebase.google.com的步骤在android studio中做:

        项目级 build.gradle (/build.gradle):

        buildscript {
          repositories {
            // Check that you have the following line (if not, add it):
            google()  // Google's Maven repository
        
          }
          dependencies {
            ...
            // Add this line
            classpath 'com.google.gms:google-services:4.3.8'
        
          }
        }
        
        allprojects {
          ...
          repositories {
            // Check that you have the following line (if not, add it):
            google()  // Google's Maven repository
        
            ...
          }
        }
        

        应用级 build.gradle (//build.gradle):

        apply plugin: 'com.android.application'
        
        // Add this line
        apply plugin: 'com.google.gms.google-services'
        
        
        dependencies {
          // Import the Firebase BoM
          implementation platform('com.google.firebase:firebase-bom:28.3.0')
        
        
          // Add the dependency for the Firebase SDK for Google Analytics
          // When using the BoM, don't specify versions in Firebase dependencies
          implementation 'com.google.firebase:firebase-analytics'
        
        
          // Add the dependencies for any other desired Firebase products
          // https://firebase.google.com/docs/android/setup#available-libraries
        }
        

        最后,在 IDE 中显示的栏中按“立即同步”:

        【讨论】:

          【解决方案7】:

          将您的 googleservices(number).json 更改为 googleservices.json 没有对我有用的数字我刚遇到同样的问题。

          【讨论】:

          • 这并不能真正回答问题。如果您有其他问题,可以点击 提问。要在此问题有新答案时收到通知,您可以follow this question。一旦你有足够的reputation,你也可以add a bounty 来引起对这个问题的更多关注。 - From Review
          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2018-05-18
          • 2019-07-26
          • 2020-04-19
          • 2017-08-10
          • 2016-07-27
          • 2016-02-25
          相关资源
          最近更新 更多