Skip to content

🐛 [firebase_analytics] After migrated to Dart-only initialization, analytics is not working on Android. #7639

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

Closed
jaeyoi opened this issue Dec 17, 2021 · 10 comments · Fixed by #7745
Labels
platform: android Issues / PRs which are specifically for Android. plugin: analytics resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working

Comments

@jaeyoi
Copy link

jaeyoi commented Dec 17, 2021

Bug report

https://firebase.flutter.dev/docs/manual-installation#android

I migrated my app to Dart-only initialization.
Then, firebase analytics is not working on Android. I got this error.

E/FA (17925): Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI

Steps to reproduce

  1. flutterfire configure
  2. Remove the /android/app/google-services.json file.
  3. Remove the google-services dependency from the /android/build.gradle file.
  4. Remove the plugin execution via the /android/app/build.gradle file.
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
...
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

  runApp(const App());
}

Expected behavior

firebase_analytics runs fine on android.


Additional context

Add any other context about the problem here.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale
    ko-KR)
[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 13.2)
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.63.2)
[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 2.15.1
Flutter SDK 2.8.1
hunmin 1.0.0+13

dependencies:
- audioplayers 0.20.1 [uuid path_provider http flutter flutter_web_plugins]
- firebase_analytics 9.0.4 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_core 1.10.6 [firebase_core_platform_interface firebase_core_web flutter meta]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- package_info_plus 1.3.0 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- url_launcher 6.0.17 [flutter meta url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]

dev dependencies:
- flutter_launcher_icons 0.9.2 [args image path yaml]
- flutter_lints 1.0.4 [lints]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- archive 3.1.6 [crypto path]
- args 2.3.0
- async 2.8.2 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- characters 1.2.0
- charcode 1.3.1
- clock 1.1.0
- collection 1.15.0
- crypto 3.0.1 [collection typed_data]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- firebase_analytics_platform_interface 3.0.3 [firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.4.0+4 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_core_platform_interface 4.2.3 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.5.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- http 0.13.4 [async http_parser meta path]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image 3.1.0 [archive meta xml]
- js 0.6.3
- lints 1.0.1
- matcher 0.12.11 [stack_trace]
- meta 1.7.0
- package_info_plus_linux 1.0.3 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.4 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 1.0.4 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.0
- path_provider 2.0.8 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.9 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.7 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.4 [ffi flutter meta path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.4 [flutter meta path_provider_platform_interface]
- path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface]
- path_provider_windows 2.0.4 [ffi flutter meta path path_provider_platform_interface win32]
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.0.2 [meta]
- process 4.2.4 [file path platform]
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- test_api 0.4.3 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- url_launcher_android 6.0.13 [flutter meta url_launcher_platform_interface]
- url_launcher_ios 6.0.13 [flutter meta url_launcher_platform_interface]
- url_launcher_linux 2.0.2 [flutter]
- url_launcher_macos 2.0.2 [flutter]
- url_launcher_platform_interface 2.0.4 [flutter plugin_platform_interface]
- url_launcher_web 2.0.5 [flutter flutter_web_plugins meta url_launcher_platform_interface]
- url_launcher_windows 2.0.2 [flutter]
- uuid 3.0.5 [crypto]
- vector_math 2.1.1
- win32 2.3.1 [ffi]
- xdg_directories 0.2.0 [meta path process]
- xml 5.3.1 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]

@jaeyoi jaeyoi added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Dec 17, 2021
@darshankawar darshankawar added the triage Issue is currently being triaged. label Dec 17, 2021
@darshankawar
Copy link

Tried the dart-only intialization steps as mentioned in https://firebase.flutter.dev/docs/manual-installation/#migrating-to-dart-only-initialization on a sample app and running it on Android does show me the same error:

Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI

firebase_analytics: ^9.0.4 and latest stable (2.8.1).

@darshankawar darshankawar added plugin: analytics platform: android Issues / PRs which are specifically for Android. and removed Needs Attention This issue needs maintainer attention. triage Issue is currently being triaged. labels Dec 17, 2021
@darshankawar
Copy link

Also seeing few reports for same error:

#7543 (comment)
#7543 (comment)
#7520 (comment)

@kkoken
Copy link

kkoken commented Dec 21, 2021

I have exact same problem with android

@NebulaFox
Copy link

I got around this issue by going back and using the old approach of with the google services file.

@youssefali424
Copy link

why deprecate manual installation then? that is so miss leading

@otger
Copy link

otger commented Dec 29, 2021

The same problem happens to me, works fine in ios, fails in android when using dart-only initialization. The only thing I did was to change the package name manually from com.example.whatever to a one with my domain, although this should not be an issue as flutterfire configure detects it correctly.

@andredealmei
Copy link

why is closed with a "doc" pr ?

@darshankawar darshankawar added the resolution: fixed A fix has been merged or is pending merge from a PR. label Jan 6, 2022
@najibghadri
Copy link

najibghadri commented Jan 16, 2022

Why is this closed @darshankawar ? It's not fixed still, I have this same problem with the dart-only installation. And all of these have been closed without a fix to either the code or docs 😕 :
#1524
#1335
#7708

This problem will have me set up manual installation again 😞

@darshankawar
Copy link

@najibghadri
Sorry for coming back late on this. According to the updated document, firebase_analytics isn't completely supported on Android for dart-only initialization and hence the same has been reflected in the PR: https://firebase.flutter.dev/docs/cli/#usage

@Joldersman
Copy link

Now solution is initialize app manually for Android
https://firebase.flutter.dev/docs/manual-installation/android
& iOS with Dart Only

like that:
import 'dart:io';

Platform.isAndroid
? await Firebase.initializeApp()
: await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);

Hope it help.

@firebase firebase locked and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android Issues / PRs which are specifically for Android. plugin: analytics resolution: fixed A fix has been merged or is pending merge from a PR. type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants