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

当前回答

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

其他回答

我在尝试运行谷歌的Firebase分析示例应用程序时收到了这个错误:

先决条件:

下载https://github.com/firebase/quickstart-android 添加快速入门/分析到Android Studio

添加程序:

Go to https://firebase.google.com/ Click on "GO TO CONSOLE" Click on "Add Project" Project name: Enter: sample-app Click "Create Project" [Takes about 10 seconds or so...] Click "Continue" On the "Getting Started" page, click "Add Firebase to your Android app" Enter package name for the android app [The full package name appears at the top of the manifest: "com.google.firebase.quickstart.analytics"] Click on download google-services.json In file explorer, add google-services.json to the directory: "quickstart/analytics/app" [Warning: Do not rename the file, it must be: google-services.json] Run 'app' The sample app already contains the necessary Gradle file settings. When adding a new project do: Tools -> Firebase -> Analytics -> Add Event -> Connect App to Firebase. Adding a project via Android Studio ensures that all the Gradle Dependecies are setup.

删除程序:

访问https://firebase.google.com/ 点击“转到控制台” 设置—>项目设置—>删除此应用 设置—>业务群组设置—>删除业务群组 输入项目ID,按delete键

我多次添加和删除示例应用程序,没有任何明显的副作用。

在android studio中:

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

从那以后我就很顺利了。

我也有同样的问题。这个问题是因为重命名文件。你可能下载了N个谷歌服务。Json文件在你的下载文件夹。因此,当你下载一个新文件时,它会以相同的名称下载,但会在括号中添加数值。类似google服务(1)。所以你必须删除这个(1)并复制文件。请确保在重命名时,不应该有任何空格或额外的空格。在文件名称中。

如果您无法访问项目的Firebase,例如,您下载了一个示例源代码,那么您必须删除任何与Firebase相关的东西才能使项目运行。

在项目中搜索关键字

列表项 织物 重火力点 谷歌服务 crashlytics

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

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

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