模块根文件夹中缺少文件google-services.json(但它位于好地方!)

时间:2021-01-12 15:23:33

I try to use google sign in in my android app, i read the page https://developers.google.com/identity/sign-in/android/start-integrating and i made all steps, now i put my google-services.json in my app folder, and after downloading the google-services.json, i do :

我尝试在我的Android应用程序中使用谷歌登录,我阅读页面https://developers.google.com/identity/sign-in/android/start-integrating,我做了所有步骤,现在我把我的谷歌服务.json在我的app文件夹中,在下载google-services.json后,我这样做:

mv Dowloads/google-services.json AndroidStudioProjects/MyApplication/app/

so, when i do :

所以,当我这样做时:

ls AndroidStudioProjects/MyApplication/app/
app.iml  build  build.gradle  google-services.json  libs  proguard-rules.pro  src

My file google-services.json seems to be at the good place,but gradle console displays an error :

我的文件google-services.json似乎处于好位置,但是gradle控制台显示错误:

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I read Error "File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it" but it isn't my probleme because my file is at the good place.

我读错误“模块根文件夹中缺少文件google-services.json。如果没有它,Google Services插件就无法运行”但这不是我的问题,因为我的文件处于好位置。

ps : And sorry for my bad english ;p

ps:抱歉我的英语不好; p

2 个解决方案

#1


2  

You also need to add these line of codes in Gradle files if you haven't already. In Module:app_name gradle file, add

如果还没有,还需要在Gradle文件中添加这些代码行。在Module:app_name gradle文件中,添加

apply plugin: 'com.google.gms.google-services'

on top of the file. And in dependencies of the same file, add

在文件顶部。在同一个文件的依赖项中,添加

compile 'com.google.android.gms:play-services:8.3.0'

Also, in Project:project_name gradle file, add

另外,在Project:project_name gradle文件中,添加

classpath 'com.google.gms:google-services:2.0.0-alpha2'

in dependencies

在依赖中

Also, try to upload a screenshot of the stack trace if this doesn't repair your problem

此外,如果这不能修复您的问题,请尝试上传堆栈跟踪的屏幕截图

#2


0  

download google-service.json file copy that file and paste it Into YourProjectName/app Directory

下载google-service.json文件复制该文件并将其粘贴到YourProjectName / app目录中

#1


2  

You also need to add these line of codes in Gradle files if you haven't already. In Module:app_name gradle file, add

如果还没有,还需要在Gradle文件中添加这些代码行。在Module:app_name gradle文件中,添加

apply plugin: 'com.google.gms.google-services'

on top of the file. And in dependencies of the same file, add

在文件顶部。在同一个文件的依赖项中,添加

compile 'com.google.android.gms:play-services:8.3.0'

Also, in Project:project_name gradle file, add

另外,在Project:project_name gradle文件中,添加

classpath 'com.google.gms:google-services:2.0.0-alpha2'

in dependencies

在依赖中

Also, try to upload a screenshot of the stack trace if this doesn't repair your problem

此外,如果这不能修复您的问题,请尝试上传堆栈跟踪的屏幕截图

#2


0  

download google-service.json file copy that file and paste it Into YourProjectName/app Directory

下载google-service.json文件复制该文件并将其粘贴到YourProjectName / app目录中