移除Gradle警告:找不到google-services.json文件。

19

自从我从 google-services:3.1.1 更换为 3.2.0 以来,我收到了以下警告

Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]

Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]

我在Gradle控制台中看到JSON文件已从正确位置解析,如果您没有使用任何flavor,则可以预期出现此情况。

Parsing json file: C:\testApp\app\google-services.json

构建正常运作。

但我真的很喜欢干净的控制台输出,那么我该如何删除这个似乎不需要的警告?


可能是 https://dev59.com/y1wY5IYBdhLWcg3w5rWq 的重复问题。 - Abhinav Gupta
2
我已经检查了其他问题,并且我认为它不是重复的。 为了明确起见,应用程序的构建和在应用程序文件夹中找到google-service.json是有效的。我只想了解为什么会显示这个警告,以及是否可以将其删除。 - Stephan Eichinger
4个回答

23

这似乎已经通过com.google.gms:google-services:4.0.2修复,该版本于2018年7月13日发布

使用google-services:4.0.2的Gradle输出:

> Configure project :app

> Task :app:processDebugGoogleServices
Parsing json file: /.../build/app/google-services.json

> Task :app:processReleaseGoogleServices
Parsing json file: /.../build/app/google-services.json

使用google-services:4.0.1的Gradle输出:

> Configure project :app
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]

> Task :app:processDebugGoogleServices
Parsing json file: /.../build/app/google-services.json

> Task :app:processReleaseGoogleServices
Parsing json file: /.../build/app/google-services.json

升级到com.google.gms:google-services:4.0.2也解决了我的问题。 - Stephan Eichinger

14

这是一个已知的回归问题。详细信息请查看Google Issue #110321069。在修复之前,安全起见,可以忽略该警告。


这真是太遗憾了,但感谢您提供的信息,我想现在这就是答案。 - Stephan Eichinger
7
我看到了“访问被拒绝”的错误信息。这个问题是不是变成了私有的?我们应该去哪里关注更新? - Colin White
我已经在这里创建了一个新的公共问题以解决此错误:https://issuetracker.google.com/issues/110321069。如果此错误影响到您,请为该问题加星标。 - Colin White

2

请尝试以下方法:

将 google-services.json 文件放置于指定路径下:

<path>

 1. [your project]\platforms\android\app\src\debug

 2. [your project]\platforms\android\app\src\release

2
这是与Google Services gradle插件相关的错误。我在此处创建了一个公共错误报告:https://issuetracker.google.com/issues/110321069 如果您想解决此问题并隐藏警告,则可以将您的google-service.json复制到app/src/debugapp/src/release中。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接