[英]Error: File google-services.json is missing. The Google Services Plugin cannot function without it.
i have already include google-services.json file in my app but it still give me error.我已经在我的应用程序中包含了 google-services.json 文件,但它仍然给我错误。 Error:Execution failed for task ':app:processDebugGoogleServices'.错误:任务“:app:processDebugGoogleServices”的执行失败。
File google-services.json is missing.文件 google-services.json 丢失。 The Google Services Plugin cannot function without it.没有它,Google 服务插件就无法运行。 Searched Location: C:\\Users\\vikas\\AndroidStudioProjects\\FireBaseFunctionality\\app\\src\\debug\\google-services.json C:\\Users\\vikas\\AndroidStudioProjects\\FireBaseFunctionality\\app\\google-services.json搜索位置:C:\\Users\\vikas\\AndroidStudioProjects\\FireBaseFunctionality\\app\\src\\debug\\google-services.json C:\\Users\\vikas\\AndroidStudioProjects\\FireBaseFunctionality\\app\\google-services.json
Had the same problem - builded before next step of tutorial.有同样的问题 - 在教程的下一步之前构建。 You have to generate and download the file from firebase website.您必须从 firebase 网站生成并下载文件。 See Error "File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it" - late, but someone may need this nowdays.请参阅错误“模块根文件夹中缺少文件 google-services.json。如果没有它,Google 服务插件将无法运行” - 晚了,但现在有人可能需要这个。
go into SDK manager --> SDK tool---->install play service and USB tool and repository I have solved same problem with above method进入 SDK 管理器 --> SDK 工具 --> 安装播放服务和 USB 工具和存储库我已经用上述方法解决了同样的问题
or u can change the name of google service google-services.json instead of google-services(any number).json或者你可以更改 google 服务的名称 google-services.json 而不是 google-services(any number).json
just change in the build.gradle the line只需在 build.gradle 中更改该行
compile fileTree (dir: 'libs', include: ['* .jar'])
to到
implementation fileTree(dir: 'libs', include: ['*.jar'])
Go to your flutter sdk folder used to build the app.转到用于构建应用程序的 flutter sdk 文件夹。 Delete all the contents in the folder .pub-cache Now pub-get and run.删除文件夹中的所有内容 .pub-cache 现在 pub-get 并运行。
Sometime we copy the downloaded file and put in app directory.有时我们复制下载的文件并放入应用程序目录。 But it changes the name.但它改变了名称。 For example googleservices(1).json instead of googleservices.json.例如 googleservices(1).json 而不是 googleservices.json。 so make sure the name of file is correct.所以请确保文件名正确。
What worked for me was:对我有用的是:
And then follow the https://console.firebase.google.com steps to do in android studio:然后按照https://console.firebase.google.com步骤在 android studio 中执行:
Project-level build.gradle (/build.gradle):项目级 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
...
}
}
App-level build.gradle (//build.gradle):应用级 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
}
Finally, press "Sync now" in the bar that appears in the IDE:最后,在 IDE 中出现的栏中按“立即同步”:
将您的 googleservices(number).json 更改为 googleservices.json no number 它对我有用 我刚刚遇到了同样的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.