Google Services Plugin cannot function without google-services.json

邮差的信 提交于 2019-12-21 13:35:32

问题


File google-services.json is missing. The Google Services Plugin cannot function

I get this error code since I deleted my google-services.json file from my project. Now the obvious way to solve this issue would be to include it again, but I had a reason to remove it.

"Note: If you enabled only Google Sign-In when you generated the configuration file, you can skip this step. Google Sign-In does not require the configuration file to be included in your project—generating the file performs the neecessary configuration steps." - this is the official note in the documentation and since I only enabled Google Sign-In I don't see a reason for this error message. Does anyone have had this problem too and a solve to it because I think that I implemented everything correctly.

Note: It works with the file in the project included.

EDIT: To clarify, my application works completely fine and I have no problems, but I wondered why I cannot remove the google-services.json file even though I should be able to do it with no problem!


回答1:


When you add apply plugin: 'com.google.gms.google-services' inside your app-level build.gradle it parses configuration information from the google-services.json file.

You removed google-services.json file, that's why it is not able to parse
So remove the below line too from your app-level build.gradle who triggered parsing to make it work again.

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



回答2:


The gradle-plugin google-services that is referenced by classpath and with apply is a build-time plugin only! So it only influences the build-process of your app, but not the runtime-process! Thats why your app is working fine but google-services json is required.




回答3:


You are using Google signin right? So u definitely need a google-services.json file

Refer this link

https://developers.google.com/identity/sign-in/android/start-integrating

Add the dependency to your project-level build.gradle:

classpath 'com.google.gms:google-services:3.0.0'

Add the plugin to your app-level build.gradle:

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



来源:https://stackoverflow.com/questions/42888018/google-services-plugin-cannot-function-without-google-services-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!