-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Bug report
firebase_core ends up depending on firebase_analytics after building a project; this is both undocumented and unexpected.
Analytics is not only included in the build, but also gets started automatically (before the main flutter app)--probably due to the Firebase ContentProvider initializer mechanism (?) in com.google.firebase.provider.FirebaseInitProvider.
The documented dependencies on https://pub.dev/packages/firebase_core as of 10/8/2020 are firebase_core_platform_interface, firebase_core_web, flutter, meta, quiver.
Since all other FlutterFire plugins depend on _core, transitively all plugins include and (!) start analytics.
Different, but related issue: why-oh-why do we have to deal with this auto-starting non-sense!? Is it so far-fetched to expect developers to make a single call to FirebaseApp.initializeApp()--when needed--instead?! I would imagine no sane developer wants/needs the google-services.json based auto-initialization. It's not helping; it's "magic code", unnecessarily adding another layer of complexity. Instead, initializing the default FirebaseApp with FirebaseOptions should work just like initialization of additional FirebaseApp instances does since v0.5.0.
Steps to reproduce
Steps to reproduce the behavior:
- set up a default new project: 'flutter create'
- build: 'flutter run'
- check dependencies to confirm no dependency on analytics: 'cd android; ./gradlew :app:dependencies'
- edit pubspec.yaml, adding a single dependency: 'firebase_core: ^0.5.0+1'
- build: 'flutter run'
- check dependencies again to see com.google.firebase:firebase-analytics bundled: 'cd android; ./gradlew :app:dependencies'
Click To Expand
+--- project :firebase_core
| +--- io.flutter:flutter_embedding_debug:1.0.0-5babba6c4d25fa237bbf755ab85c9a0c50b3c6ec (*)
| +--- com.google.firebase:firebase-core -> 17.4.1
| | \--- com.google.firebase:firebase-analytics:17.4.1
| | +--- com.google.android.gms:play-services-measurement:17.4.1
| | +--- com.google.android.gms:play-services-measurement-api:17.4.1
| | \--- com.google.android.gms:play-services-measurement-sdk:17.4.1
Expected behavior
An app without analytics, unless an explicit dependency (with substantial reason) on it exists.
Flutter doctor
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.0, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Android Studio (version 4.0)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
[✓] Connected device (1 available)
• No issues found!
Flutter dependencies
Click To Expand
Dart SDK 2.10.0
Flutter SDK 1.22.0
testapp 1.0.0+1
dependencies:
- cupertino_icons 1.0.0
- firebase_core 0.5.0+1 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
dev dependencies:
- 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:
- async 2.5.0-nullsafety.1 [collection]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- clock 1.1.0-nullsafety.1
- collection 1.15.0-nullsafety.3
- fake_async 1.2.0-nullsafety.1 [clock collection]
- firebase 7.3.0 [http http_parser js]
- firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- http 0.12.2 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- js 0.6.2
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- path 1.8.0-nullsafety.1
- pedantic 1.9.2 [meta]
- plugin_platform_interface 1.0.3 [meta]
- quiver 2.1.3 [matcher meta]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0-nullsafety.3 [collection]
- vector_math 2.1.0-nullsafety.3