一些 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 可以分为三类:
- 需要播放服务——这些 SDK 需要 Google Play 服务,否则它们没有任何功能。
- 推荐的 Play 服务——这些 SDK 要求 Google Play 服务具有完整的功能,但即使没有 Google Play 服务,它们仍能提供大部分功能。
- 不需要 Play 服务——这些 SDK 不需要 Google Play 服务具有完整的功能。
下表仅适用于每个 SDK 的最新版本。一些旧版本可能有更严格的要求。
不需要Google Play 服务
产品 | 图书馆 | 谷歌播放服务? |
---|---|---|
应用检查自定义和调试提供程序 | com.google.firebase:firebase-appcheck:16.0.0 com.google.firebase:firebase-appcheck-debug:16.0.0 | 不需要 |
应用分发 | com.google.firebase:firebase-appdistribution:16.0.0-beta02 com.google.firebase:firebase-appdistribution-ktx:16.0.0-beta02 | 不需要 |
验证 | com.google.firebase:firebase-auth:21.0.4 com.google.firebase:firebase-auth-ktx:21.0.4 | 不需要 |
云防火墙 | com.google.firebase:firebase-firestore:24.1.2 com.google.firebase:firebase-firestore-ktx:24.1.2 | 不需要 |
Firebase 客户端 SDK 的云函数 | com.google.firebase:firebase-functions:20.1.0 com.google.firebase:firebase-functions-ktx:20.1.0 | 不需要 |
Firebase 的云存储 | com.google.firebase:firebase-storage:20.0.1 com.google.firebase:firebase-storage-ktx:20.0.1 | 不需要 |
崩溃分析器 | com.google.firebase:firebase-crashlytics:18.2.10 com.google.firebase:firebase-crashlytics-ktx:18.2.10 | 不需要 |
应用内消息 | com.google.firebase:firebase-inappmessaging:20.1.2 com.google.firebase:firebase-inappmessaging-ktx:20.1.2 | 不需要 |
应用内消息显示 | com.google.firebase:firebase-inappmessaging-display:20.1.2 com.google.firebase:firebase-inappmessaging-display-ktx:20.1.2 | 不需要 |
Firebase 安装 | com.google.firebase:firebase-installations:17.0.1 com.google.firebase:firebase-installations-ktx:17.0.1 | 不需要 |
性能监控 | com.google.firebase:firebase-perf:20.0.6 com.google.firebase:firebase-perf-ktx:20.0.6 | 不需要 |
实时数据库 | com.google.firebase:firebase-database:20.0.5 com.google.firebase:firebase-database-ktx:20.0.5 | 不需要 |
远程配置 | com.google.firebase:firebase-config:21.1.0 com.google.firebase:firebase-config-ktx:21.1.0 | 不需要 |
需要或推荐使用 Google Play 服务
产品 | 图书馆 | 谷歌播放服务? |
---|---|---|
AdMob | com.google.android.gms:play-services-ads:20.6.0 | 受到推崇的* |
分析 | com.google.firebase:firebase-analytics:21.0.0 com.google.firebase:firebase-analytics-ktx:21.0.0 | 受到推崇的* |
App Check Play Integrity 提供商 | com.google.firebase:firebase-appcheck-playintegrity:16.0.0 | 必需的 |
应用检查 SafetyNet 提供商 | com.google.firebase:firebase-appcheck-safetynet:16.0.0 | 必需的 |
应用索引 | com.google.firebase:firebase-appindexing:20.0.0 | 必需的 |
云消息传递 | com.google.firebase:firebase-messaging:23.0.5 com.google.firebase:firebase-messaging-ktx:23.0.5 | 必需的 |
动态链接 | com.google.firebase:firebase-dynamic-links:21.0.1 com.google.firebase:firebase-dynamic-links-ktx:21.0.1 | 必需的 |
Firebase 机器学习视觉 | com.google.firebase:firebase-ml-vision:24.1.0 | 必需的 |
Firebase ML 自定义模型 | com.google.firebase:firebase-ml-model-interpreter:22.0.4 | 必需的 |
* 适用于 Google Analytics 的 Firebase SDK 可以在任何设备上发送事件,但某些自动洞察信息(例如人口统计数据)仅适用于具有 Google Play 服务的设备。