我将我的项目更新到最新的Play服务类路径“com.google.gms:google-services:1.5.0-beta2”。我也在我的app.gradle文件中使用最新版本的playservices:

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

然而,当我编译时,Gradle抛出异常如下

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

当前回答

在我的情况下,我保存了一个json文件,像这样的空格

谷歌服务. json

右边的是

google-services.json

还要注意不要把(_)写成(-)

可能会帮助一些人。

其他回答

请访问这个URL:

https://developers.google.com/mobile/add

选择你的选项,最后你将能够下载

google服务。json文件

复制该文件并粘贴到

YourProjectName / app目录

然后重新编译项目,它很可能会飞

在我的例子中,项目目录看起来像这样:

在android studio中:

切换到项目视图,这样你就可以看到实际的项目文件夹结构。 发现谷歌服务。json文件,并将其拖到app目录(由于某种原因,当我使用文件资源管理器添加它时,它把它放在gradle文件夹中)。 清洁/重建项目。

从那以后我就很顺利了。

对于从firebase codelabs教程第3步来到这里的人:请转到第4页。

Apparently, if google says You should now have the android-start project open in Android Studio. ,She means it,and not You should now have the android-start project open in Android Studio, without any build-errors . As the instruction says there, you have to get a configuration file from firebase. i.e , create a new project in your firebase acc with name 'friendly chat and in the next page , add its package name and SHA1 KEY. after downloading the json file,add it to your project>app folder, and Rebuild project.

对于任何使用Firebase的人来说,你需要进入你的控制台,它会显示“将项目添加到Android”。从那里,它将逐步生成谷歌的服务。Json文件。

即使在添加了所有依赖项和文件之后,如果你遇到任何这样的问题,它可能是你不正确的文件名“google-services.json”。

请确保您有确切的文件名,没有任何额外的空格或字符。

我已经重命名了文件,在我的文件名中有空格“”,这是不明显的,后来我发现我的文件名是错误的,所以修正它!