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

当前回答

非常简单的 点击工具->Firebase->连接到Firebase,然后点击同步 这肯定会奏效。

其他回答

从开发人员的站点转到配置文件,并将其粘贴到当前项目的应用程序级目录中。

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

如果你不再需要它了……

…\ build.gradle:

类路径的com.google.gms:谷歌服务:3.2.0

->

// classpath 'com.google.gms:google-services:3.2.0'

…\ app \ build.gradle:

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

->

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

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

添加google-service最简单的方法。json文件

在Android Studio中遵循以下步骤:

单击“工具> Firebase”,打开“助手”窗口。

单击以展开列出的功能之一(例如“分析”),然后单击“入门”教程以连接到Firebase并将必要的代码添加到应用程序中。