没有Google-services.json的Google Services插件将无法运行>> [

问题描述 投票:6回答:4
缺少文件google-services.json。 Google服务插件无法运行

因为从项目中删除了google-services.json文件,所以我收到此错误代码。现在解决此问题的明显方法是再次添加它,但是我有理由删除它。

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.”-这是文档中的正式说明,由于

我仅启用了Google登录

,所以看不到出现此错误消息的原因。是否有人也遇到过这个问题并解决了这个问题,因为我认为我正确实施了所有内容。

注意:它与包含的项目中的文件配合使用。

EDIT:为了澄清,我的应用程序运行正常,并且没有问题,但是我想知道为什么即使我应该没问题也不能删除google-services.json文件!] >

缺少文件google-services.json。 Google服务插件无法正常运行,因为我从项目中删除了google-services.json文件,因此无法获取此错误代码。现在是解决此问题的明显方法...

当您在应用程序级别apply plugin: 'com.google.gms.google-services'中添加build.gradle时,它将解析google-services.json文件中的配置信息。
您删除了google-services.json文件,这就是为什么它无法解析的原因,因此也从触发解析以使其再次起作用的应用程序级别build.gradle中删除以下行。

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

由classpath引用并与apply一起使用的gradle-plugin google-services仅是一个构建时插件!因此,它只会影响应用程序的构建过程,而不会影响运行时过程!这就是为什么您的应用可以正常运行,但需要使用google-services json的原因。

您正在使用Google登录吗?因此,您绝对需要google-services.json文件
引用此链接

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

将依赖项添加到您的项目级build.gradle:

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

将插件添加到您的应用级build.gradle:

应用插件:'com.google.gms.google-services'

我没有此插件(类路径'com.google.gms:google-services:3.0.0')我仍然收到此问题
android json android-studio google-signin google-authentication
4个回答
12
投票

1
投票

-1
投票
引用此链接

-1
投票
© www.soinside.com 2019 - 2024. All rights reserved.