Android、Firebase.analytics 未解决

问题描述 投票:0回答:1

查看 https://firebase.google.com/docs/analytics/get-started?platform=android 我们可以设置 Firebase Analytics。

dependencies {
    // Import the BoM for the Firebase platform
    implementation(platform("com.google.firebase:firebase-bom:33.2.0"))

    // Add the dependency for the Analytics library
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation("com.google.firebase:firebase-analytics")
}

然后在MainActivity中:

private lateinit var firebaseAnalytics: FirebaseAnalytics

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    // Obtain the FirebaseAnalytics instance.
    firebaseAnalytics = Firebase.analytics
}

但是

Firebase.analytics
还没有解决。

android firebase-analytics
1个回答
0
投票

代替

implementation("com.google.firebase:firebase-analytics")
使用
implementation("com.google.firebase:firebase-analytics-ktx")

或者,也许设置

firebaseAnalytics = FirebaseAnalytics.getInstance(this)

© www.soinside.com 2019 - 2024. All rights reserved.