一些 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 服务
产品 | 图书馆 | 谷歌播放服务? |
---|---|---|
App Check 自定义和调试提供程序 | com.google.firebase:firebase-appcheck:16.1.1 com.google.firebase:firebase-appcheck-ktx:16.1.1 com.google.firebase:firebase-appcheck-debug:16.1.1 | 不需要 |
应用程序分发 API | com.google.firebase:firebase-appdistribution-api:16.0.0-beta05 com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta05 | 不需要 |
应用分发 | com.google.firebase:firebase-appdistribution:16.0.0-beta05 | 不需要 |
验证 | com.google.firebase:firebase-auth:21.1.0 com.google.firebase:firebase-auth-ktx:21.1.0 | 不需要 |
云端 Firestore | com.google.firebase:firebase-firestore:24.4.2 com.google.firebase:firebase-firestore-ktx:24.4.2 | 不需要 |
Firebase 客户端 SDK 的云函数 | com.google.firebase:firebase-函数:20.2.2 com.google.firebase:firebase-functions-ktx:20.2.2 | 不需要 |
用于 Firebase 的云存储 | com.google.firebase:firebase-storage:20.1.0 com.google.firebase:firebase-storage-ktx:20.1.0 | 不需要 |
崩溃分析 | com.google.firebase:firebase-crashlytics:18.3.3 com.google.firebase:firebase-crashlytics-ktx:18.3.3 | 不需要 |
应用内消息 | com.google.firebase:firebase-inappmessaging:20.3.0 com.google.firebase:firebase-inappmessaging-ktx:20.3.0 | 不需要 |
应用内消息显示 | com.google.firebase:firebase-inappmessaging-display:20.3.0 com.google.firebase:firebase-inappmessaging-display-ktx:20.3.0 | 不需要 |
Firebase 安装 | com.google.firebase:firebase 安装:17.1.0 com.google.firebase:firebase-installations-ktx:17.1.0 | 不需要 |
性能监控 | com.google.firebase:firebase-perf:20.3.1 com.google.firebase:firebase-perf-ktx:20.3.1 | 不需要 |
实时数据库 | com.google.firebase:firebase-数据库:20.1.0 com.google.firebase:firebase-数据库-ktx:20.1.0 | 不需要 |
远程配置 | com.google.firebase:firebase-config:21.2.1 com.google.firebase:firebase-config-ktx:21.2.1 | 不需要 |
需要或推荐的 Google Play 服务
产品 | 图书馆 | 谷歌播放服务? |
---|---|---|
AdMob | com.google.android.gms:play-services-ads:21.5.0 | 推荐的* |
分析 | com.google.firebase:firebase-analytics:21.2.0 com.google.firebase:firebase-analytics-ktx:21.2.0 | 推荐的* |
App Check Play 完整性提供商 | com.google.firebase:firebase-appcheck-playintegrity:16.1.1 | 必需的 |
App Check SafetyNet 提供商 | com.google.firebase:firebase-appcheck-safetynet:16.1.1 | 必需的 |
应用索引 | com.google.firebase:firebase-appindexing:20.0.0 | 必需的 |
云消息 | com.google.firebase:firebase-消息:23.1.1 com.google.firebase:firebase-messaging-ktx:23.1.1 | 必需的 |
动态链接 | com.google.firebase:firebase-动态链接:21.1.0 com.google.firebase:firebase-动态链接-ktx:21.1.0 | 必需的 |
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 服务的设备。