我将我的项目更新到最新的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.

当前回答

请访问这个URL:

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

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

google服务。json文件

复制该文件并粘贴到

YourProjectName / app目录

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

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

其他回答

https://developers.google.com/android/ 你需要生成一个配置文件,它可以让你访问你在开发人员控制台注册的所有服务和api,并把它放在根目录中

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

请访问这个URL:

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

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

google服务。json文件

复制该文件并粘贴到

YourProjectName / app目录

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

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

也面临过同样的问题…

在我的情况下,我已经拯救了

google-services.json

as

google_services.json

我尝试了上面提到的每一种解决方案,但都没有帮助…… 错误是你需要把“_”换成“-”(破折号)。

只是将文件重构到google-services。来自google_services的Json。Json工作很有魅力..

希望这能有所帮助!!

附注:我知道这听起来很傻,但这只对我有用……

对于从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.