使用 com.google.gms.google-services gradle 插件时出现 NoSuchMethodError。

NoSuchMethodError when using com.google.gms.google-services gradle plugin.

尝试将 Google 登录与 Android 应用程序集成时,我在尝试启动该应用程序时遇到 NoSuchMethod 错误。我将错误追溯到我的 build.gradle 中包含 com.google.gms.google-services 插件。但是,除了删除 gradle 插件之外,我不知道如何解决这个问题。

事实证明,com.google.gms.google-services 插件包含的 play-services-measurement 版本与我应用中其他 Google Play 服务依赖项的版本不匹配。通过手动添加

compile 'com.google.android.gms:play-services-measurement:8.4.0'

我的 build.gradle,我能够解决问题。

为什么 Google 需要这种依赖性,以及它的作用是另一天的问题。