Firebase Android SDK 对 Google Play 服务的依赖

某些 Firebase Android SDK 依赖于 Google Play 服务,这意味着它们将仅在安装了 Google Play 服务的设备和模拟器上运行。这些 Firebase SDK 与设备上的 Google Play 服务后台服务通信,以便为您的应用提供最新且安全的轻量级 API。某些 Android 设备(例如 Amazon Kindle Fire 设备或在某些区域出售的设备)未安装 Google Play 服务。

哪些 Firebase Android SDK 需要 Google Play 服务?

Firebase SDK 可分为三个类别:

  • 需要 Play 服务 - 这些 SDK 需要 Google Play 服务,否则它们将无法提供功能。
  • 推荐使用 Play 服务 - 这些 SDK 需要使用 Google Play 服务才能提供完整功能,但即使没有 Google Play 服务,它们仍可提供大多数功能。
  • 不需要 Play 服务 - 这些 SDK 不需要使用 Google Play 服务也可提供完整功能。

下表仅列出了每个 SDK 最新版本的要求。某些旧版本可能有更严格的要求。

需要使用 Google Play 服务

产品 是否需要 Google Play 服务?
App Check 自定义和调试提供程序 com.google.firebase:firebase-appcheck:17.0.1
com.google.firebase:firebase-appcheck-ktx:17.0.1
com.google.firebase:firebase-appcheck-debug:17.0.1
不需要
App Distribution API com.google.firebase:firebase-appdistribution-api:16.0.0-beta10
com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta10
不需要
App Distribution com.google.firebase:firebase-appdistribution:16.0.0-beta10 不需要
Authentication com.google.firebase:firebase-auth:22.1.2
com.google.firebase:firebase-auth-ktx:22.1.2
不需要
Cloud Firestore com.google.firebase:firebase-firestore:24.8.1
com.google.firebase:firebase-firestore-ktx:24.8.1
不需要
Cloud Functions for Firebase 客户端 SDK com.google.firebase:firebase-functions:20.3.1
com.google.firebase:firebase-functions-ktx:20.3.1
不需要
Cloud Storage for Firebase com.google.firebase:firebase-storage:20.2.1
com.google.firebase:firebase-storage-ktx:20.2.1
不需要
Crashlytics com.google.firebase:firebase-crashlytics:18.4.3
com.google.firebase:firebase-crashlytics-ktx:18.4.3
不需要
In-App Messaging com.google.firebase:firebase-inappmessaging:20.3.5
com.google.firebase:firebase-inappmessaging-ktx:20.3.5
不需要
In-App Messaging Display com.google.firebase:firebase-inappmessaging-display:20.3.5
com.google.firebase:firebase-inappmessaging-display-ktx:20.3.5
不需要
Firebase 安装 com.google.firebase:firebase-installations:17.1.4
com.google.firebase:firebase-installations-ktx:17.1.4
不需要
Performance Monitoring com.google.firebase:firebase-perf:20.4.1
com.google.firebase:firebase-perf-ktx:20.4.1
不需要
Realtime Database com.google.firebase:firebase-database:20.2.2
com.google.firebase:firebase-database-ktx:20.2.2
不需要
Remote Config com.google.firebase:firebase-config:21.4.1
com.google.firebase:firebase-config-ktx:21.4.1
不需要
产品 是否需要 Google Play 服务?
AdMob com.google.android.gms:play-services-ads:22.4.0 推荐使用*
分析 com.google.firebase:firebase-analytics:21.3.0
com.google.firebase:firebase-analytics-ktx:21.3.0
推荐使用*
App Check Play Integrity 提供程序 com.google.firebase:firebase-appcheck-playintegrity:17.0.1 必填
App Check SafetyNet 提供程序 com.google.firebase:firebase-appcheck-safetynet:16.1.2 需要
App Indexing com.google.firebase:firebase-appindexing:20.0.0 需要
Cloud Messaging com.google.firebase:firebase-messaging:23.2.1
com.google.firebase:firebase-messaging-ktx:23.2.1
必填
Dynamic Links com.google.firebase:firebase-dynamic-links:21.1.0
com.google.firebase:firebase-dynamic-links-ktx:21.1.0
需要
Firebase ML Vision com.google.firebase:firebase-ml-vision:24.1.0 需要
Firebase ML 自定义模型 com.google.firebase:firebase-ml-model-interpreter:22.0.4 需要

* Firebase SDK for Google Analytics 可以在任何设备上发送事件,但一些自动分析数据(例如受众特征)仅在安装了 Google Play 服务的设备上提供。