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

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

更新:

Goto

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


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


请访问这个URL:

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

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

google服务。json文件

复制该文件并粘贴到

YourProjectName / app目录

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

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


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


我只是在下载谷歌服务时遇到了问题。json从Firebase控制台。结果我不得不注销除Firebase账户外的所有谷歌账户。


这个问题是因为:-您粘贴到从firebase控制台下载的产品的文件夹或文件没有命名为google-services.json。点击它,然后在所有选项中单击鼠标右键打开折射器并将其重命名为google-services。json。因为这对我很管用


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


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


也面临过同样的问题…

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

google-services.json

as

google_services.json

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

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

希望这能有所帮助!!

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


您必须进入Firebase控制台—>设置—>项目设置,然后会有下载最新配置文件的部分。下载谷歌服务。并放入app文件夹。这是我的工作。 链接: https://developers.google.com/identity/sign-in/android/start-integrating https://developers.google.com/android/guides/client-auth


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

谷歌服务. json

右边的是

google-services.json

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

可能会帮助一些人。


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


步骤:

导航到你的项目文件夹,打开/app子文件夹。 在这里粘贴.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.


在android studio中:

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

从那以后我就很顺利了。


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


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

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

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


我在尝试运行谷歌的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键

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


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

在Android Studio中遵循以下步骤:

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

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


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

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

复制该文件并粘贴到

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


对于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",
  ...
}

祝你好运…


如果你不再需要它了……

…\ 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,例如,您下载了一个示例源代码,那么您必须删除任何与Firebase相关的东西才能使项目运行。

在项目中搜索关键字

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