首页 > 解决方案 > 在 Flutter 应用中通过 Firebase 进行身份验证最少需要哪些 Google Play 服务 API?

问题描述

Flutter 文档中的 Firebase 表示应该将整个 google 服务放入依赖项中。

dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.2.1'   // new
}

正如其他人所建议的那样(https://stackoverflow.com/a/39513236/5369792),这不是一个好的做法,因为它会下载所有 API,因为它会使应用程序膨胀。其中大部分是不必要的,并且导致即使对于具有用户登录的最小“hello world”应用程序也需要 Multidex。

Google Play Services 根据https://developers.google.com/android/guides/setup有很多 API,它们都是通过上述依赖要求下载的,仅仅是因为 Firebase 想要读取 google services json 文件。

仅添加 Firebase 实际需要的特定依赖项会更有效。所以问题是 Firebase 需要哪个依赖项(-ies)来进行最少的用户身份验证并只读取 google 服务 json 文件?

标签: firebasedependenciesfluttergoogle-play-services

解决方案


推荐阅读