firebase-core 和 firebase-analytics 库有什么区别?

What the difference in firebase-core and firebase-analytics libraray?

Google 最近发布了 Firebase 的新版本。所以我试图迁移到 Firebase 分析。

那么这些库有什么区别

com.google.firebase:firebase-analytics:9.0.0

com.google.firebase:firebase-core:9.0.0

我发现核心也用于分析。 那么有什么区别呢?我应该使用哪个。

目前没有区别。

firebase-core:9.0.0 在 aar 文件中没有 类 和资源,包含 firebase-analytics,您可以在 pom 文件中查看。

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-core</artifactId>
  <version>9.0.0</version>
  <packaging>aar</packaging>
  <dependencies>
    <dependency>
      <groupId>com.google.firebase</groupId>
      <artifactId>firebase-analytics</artifactId>
      <version>9.0.0</version>
      <scope>compile</scope>
      <type>aar</type>
    </dependency>
  </dependencies>
</project>

您还可以在 the doc 中找到:

com.google.firebase:firebase-core:9.0.0 ->> Analytics

显然自 2018 年 6 月 12 日起声明 com.google.firebase:firebase-core 需要使用任何 Firebase 功能 (firebase.google.com/support/release-notes/android#update_may_23_2018)。 根据 firebase.google.com/docs/android/setup#available-librariesfirebase-analytics 甚至不是 public 模块,可能不打算直接使用。

基于 google docs 你不再需要 firebase-core:

You no longer need to add the Android library com.google.firebase:firebase-core. This SDK included the Firebase SDK for Google Analytics. Now, to use Analytics (or any of the Firebase products that require or recommend the use of Analytics), you need to explicitly add the Analytics dependency: com.google.firebase:firebase-analytics:17.2.0.