I have created a new Flutter project and created Firebase apps using flutterfire configure, Analytics works perfectly fine in iOS, but the android app didin't trigger analytics even a single time. It's been 7 days. Initially, i thought the delay in event but it's not working at all.
I have added Crashlytics as well, but that's working for both Android and iOS.
<project>/build.gradle
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Google services
classpath 'com.google.gms:google-services:4.4.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
...other stuff
<project>/app/build.gradle
plugins {
id "com.android.application"
id 'com.google.gms.google-services'
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
...other stuff
as for error information, I'm only getting
E/FA (15604): Missing google_app_id. Firebase Analytics disabled. See ####
Tried so far
google-services.jsongoogle_app_id in strings.xmlbuild.gradle files, flutterfire configure not adding anything in these filesflutterfire = 0.2.7Can anyone help me to add Firebase analytics in flutter app?
I recently had the same problem. The issue (at least for me) did come from an outdated version of the flutterfire tool. Since it did not work with the new style of applying plugins.
You can upgrade it by running:
dart pub global activate flutterfire_cli 1.0.0 --overwrite
It changed the following parts of my project:
settings.gradle
Old:
...
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
}
...
New:
...
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
// START: FlutterFire Configuration
id "com.google.gms.google-services" version "4.3.15" apply false
id "com.google.firebase.firebase-perf" version "1.4.1" apply false
id "com.google.firebase.crashlytics" version "2.8.1" apply false
// END: FlutterFire Configuration
}
...
As well as the android/app/build.gradle at the very top of the file.
Old:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
...
New:
plugins {
id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
id 'com.google.firebase.firebase-perf'
id 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
...
Hope this helps and you can fix the issue ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With