繁体   English   中英

错误:文件 google-services.json 丢失。 没有它,Google 服务插件就无法运行。

[英]Error: File google-services.json is missing. The Google Services Plugin cannot function without it.

我已经在我的应用程序中包含了 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

有同样的问题 - 在教程的下一步之前构建。 您必须从 firebase 网站生成并下载文件。 请参阅错误“模块根文件夹中缺少文件 google-services.json。如果没有它,Google 服务插件将无法运行” - 晚了,但现在有人可能需要这个。

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

或者你可以更改 google 服务的名称 google-services.json 而不是 google-services(any number).json

只需在 build.gradle 中更改该行

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

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

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

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

对我有用的是:

然后按照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 中出现的栏中按“立即同步”:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM