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

当前回答

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

选择开始,进入设置logo,然后是项目设置 之后,你会看到下面的平台,如web,android,ios。根据您的喜好选择。 然后下载 google服务。json文件

复制该文件并粘贴到

YourProjec / app目录 最后再次同步。

其他回答

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

步骤:

导航到你的项目文件夹,打开/app子文件夹。 在这里粘贴.json文件。 重新构建项目。

对于Cordova应用程序:

我们需要放置谷歌服务。json文件在应用程序根(我相信;当使用Cordova应用程序时,我们不进入其他文件夹/文件,如Gradle, Java文件,平台等;相反,只能通过config.xml和www文件夹来使用它们),并在config.xml中引用它,如下所示:

<platform name="android">
    <!-- Add this line -->
    <resource-file src="google-services.json" target="app/google-services.json" />
</platform>

注意:确保Firebase App packagename与<widget id="<packagename>"中的id属性相同…>是一样的。

为例:

<!-- config.xml of Cordova App -->
<widget id="com.appFactory.torchapp" ...>

<!--google-serivces.json from generated from Firebase console.-->
{
  ...
  packagename: "com.appFactory.torchapp",
  ...
}

祝你好运…

在你的Android Studio中找到工具>Firebase,然后点击连接你的应用到Firebase。他们会帮你安排的。

您需要从开发人员的站点获取配置文件,并将其粘贴到项目的应用程序级目录中。

更新:

Goto

https://console.firebase.google.com/ 选择您的项目 在左侧菜单中,单击设置>项目设置 添加一个应用程序或下载谷歌服务。json文件在你的应用程序部分。