I have empty analytics in firebase dashboard.
Firebase Messaging is working fine though.
This is my dependency :
implementation platform('com.google.firebase:firebase-bom:32.7.3')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
Google Services plugin is also added in the Module level build gradle file like this :
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
Project Build Gradle :
plugins {
id 'com.android.application' version '8.2.2' apply false
id 'com.android.library' version '8.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'com.google.gms.google-services' version '4.4.1' apply false
}
Now, In my MainAcitivty, I have initalzied it like. ( No explicit firebaseApp initialization because that is setup automatically by google services json file )
class MainActivity : AppCompatActivity() {
private lateinit var firebaseAnalytics: FirebaseAnalytics
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(LayoutInflater.from(this@MainActivity))
setContentView(binding.root)
firebaseAnalytics = FirebaseAnalytics.getInstance(this)
firebaseAnalytics.setAnalyticsCollectionEnabled(true)
}
What would be the workaround for this?
I tried with kotlin way of initialization as stated in docs too, which is again not working --> Firebase.analytics