-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 [firebase_analytics] Not working on Android with manual or Dart only initialization #11271
Comments
Additional info:
where Events show up in real-time in Analytics. |
@asterion2nd |
@darshankawar It still does not work. I ran I also checked both Debug View and the realtime page of Analytics. Also, I printed out the FirebaseApp instance and all parameters match with those in google-sevices.json.
android/app/build.gradle:
android/build.gradle:
|
Thanks for the update and patience. Can you try the plugin example with your setup and see if using it, you still get the reported behavior or not ? |
@darshankawar Please go ahead and close this issue. |
Bug report
Describe the bug
Firebase Analytics does not work on Android after running
flutterfire configure
and either usingFirebase.initializeApp()
or
Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform)
I then set
final analyticsInstance = FirebaseAnalytics.instance;
And send events using:
await analyticsInstance?.logEvent(name: eventName, parameters: parameters,);
No error messages shows up. At the same time, Analytics works on iOS and Firebase Cloud Messaging works on both Android and iOS.
Steps to reproduce
Steps to reproduce the behavior:
Add to pubspec.yaml:
firebase_core: ^2.14.0
firebase_messaging: ^14.6.4
firebase_analytics: ^10.4.3
flutterfire configure
Select project
Check if android/app/google-services.json was created
Check if lib/firebase_options.dart was created
Check if android/build.gradle has
classpath 'com.google.gms:google-services:4.3.10'
Check if android/app/build.gradle has
apply plugin: 'com.google.gms.google-services'
Try to initialize Firebase using either
Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
or
Firebase.initializeApp();
Connect android device
Run
$ adb shell setprop debug.firebase.analytics.app <package_id>
Build and run the app
Check Debug View in Firebase
Check if Analytics data from Android deviced get saved after releasing the app.
Expected behavior
Debug View in Firebase should record events from an Android device after installing the app using
flutter run
or "Run without debugging in VS Code"Analytics property should record data from Android devices running the latest version published to Play Store (works for iOS devices).
Additional context
pubspec.yaml:
environment:
sdk: ">=2.12.0 <3.0.0"
firebase_core: ^2.14.0
firebase_messaging: ^14.6.4
firebase_analytics: ^10.4.3
android/app/build.gradle:
$ flutterfire configure added the following:
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
which initially looked like:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Then I tried moving apply plugin: 'com.google.gms.google-services' to the bottom.
android/build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Debug View
Executed
$ adb shell setprop debug.firebase.analytics.app <package_id>
And went to Debug View on Firebase. Nothing shows up.
The app is already in production but no Android data get saved.
Also, "android/app/google-services.json" is correct (FCM works on Android) and I double checked all values against my Firebase project.
I tried all workarounds on these threads and nothing seems to work:
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
The text was updated successfully, but these errors were encountered: