Skip to content
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_core] "Firebase.initializeApp" is not working #8604

Closed
asai569 opened this issue May 6, 2022 · 7 comments
Closed

🐛 [firebase_core] "Firebase.initializeApp" is not working #8604

asai569 opened this issue May 6, 2022 · 7 comments
Labels
closed-by-bot resolution: no-response Customer did not respond after some time. Stale Issue with no recent activity type: bug Something isn't working

Comments

@asai569
Copy link

asai569 commented May 6, 2022

Bug report

Describe the bug

WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();

is not working in Android.

Steps to reproduce

WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();

is setting. and run

firebase_core: ^1.16.0
flutter doctor

Expected behavior

Sample project


Additional context


Flutter doctor


[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3.1 21E258 darwin-x64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.66.2)
[✓] VS Code (version 1.60.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

Flutter dependencies

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

Click To Expand

dependencies:
- badges 2.0.2 [flutter]
- cloud_firestore 3.1.14 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- cupertino_icons 1.0.4
- device_info_plus 3.2.2 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows]
- firebase_core 1.16.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.7.2 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- fk_user_agent 2.1.0 [flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine]
- flutter_flavorizr 2.1.2 [flutter archive args checked_yaml collection image io json_annotation sprintf xml yaml]
- flutter_hooks 0.18.2+1 [flutter]
- flutter_image_compress 1.1.0 [flutter]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path typed_data vector_math]
- flutter_riverpod 1.0.3 [collection flutter meta riverpod state_notifier]
- flutter_svg 1.0.3 [flutter meta path_drawing vector_math xml]
- freezed_annotation 1.1.0 [collection json_annotation meta]
- hooks_riverpod 1.0.3 [collection flutter flutter_hooks flutter_riverpod riverpod state_notifier]
- image_picker 0.8.4+11 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface]
- package_info 2.0.2 [flutter]
- path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- permission_handler 8.3.0 [flutter meta permission_handler_platform_interface]
- riverpod 1.0.3 [collection meta state_notifier]
- rxdart 0.27.3
- shared_preferences 2.0.13 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- simple_logger 1.9.0 [logging stack_trace]

dev dependencies:
- build_runner 2.1.8 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- effective_dart 1.3.2
- 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 material_color_utilities meta source_span stream_channel string_scanner term_glyph typed_data]
- freezed 1.1.1 [analyzer build build_config collection meta source_gen freezed_annotation]

transitive dependencies:
- _fe_analyzer_shared 36.0.0 [meta]
- analyzer 3.3.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- archive 3.2.2 [crypto path]
- args 2.3.0
- async 2.8.2 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- build 2.2.1 [analyzer async convert crypto glob logging meta path]
- build_config 1.0.0 [checked_yaml json_annotation path pubspec_parse yaml]
- build_daemon 3.0.1 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 2.0.6 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml]
- build_runner_core 7.2.3 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml]
- built_collection 5.1.1
- built_value 8.1.4 [built_collection collection fixnum meta]
- characters 1.2.0
- charcode 1.3.1
- checked_yaml 2.0.1 [json_annotation source_span yaml]
- clock 1.1.0
- cloud_firestore_platform_interface 5.5.5 [collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.6.14 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
- code_builder 4.1.0 [built_collection built_value collection matcher meta]
- collection 1.15.0
- convert 3.0.1 [typed_data]
- cross_file 0.3.2 [flutter js meta]
- crypto 3.0.1 [collection typed_data]
- dart_style 2.2.2 [analyzer args path pub_semver source_span]
- device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta]
- device_info_plus_macos 2.2.2 [device_info_plus_platform_interface flutter]
- device_info_plus_platform_interface 2.3.0+1 [flutter meta plugin_platform_interface]
- device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter]
- device_info_plus_windows 2.1.1 [device_info_plus_platform_interface ffi flutter win32]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- firebase_core_platform_interface 4.3.0 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.6.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_crashlytics_platform_interface 3.2.5 [collection firebase_core flutter meta plugin_platform_interface]
- fixnum 1.0.0
- flutter_plugin_android_lifecycle 2.0.5 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math]
- frontend_server_client 2.1.2 [async path]
- glob 2.0.2 [async collection file path string_scanner]
- graphs 2.1.0 [collection]
- http 0.13.4 [async http_parser meta path]
- http_multi_server 3.2.0 [async]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image 3.1.3 [archive meta xml]
- image_picker_for_web 2.1.6 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_platform_interface 2.4.4 [cross_file flutter http plugin_platform_interface]
- intl 0.17.0 [clock path]
- io 1.0.3 [meta path string_scanner]
- js 0.6.3
- json_annotation 4.4.0 [meta]
- lints 1.0.1
- logging 1.0.2
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.3
- meta 1.7.0
- mime 1.0.1
- package_config 2.0.2 [path]
- path 1.8.0
- path_drawing 1.0.0 [vector_math meta path_parsing flutter]
- path_parsing 1.0.0 [vector_math meta]
- path_provider_android 2.0.12 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.8 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.5 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32]
- permission_handler_platform_interface 3.7.0 [flutter meta plugin_platform_interface]
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- pool 1.5.0 [async stack_trace]
- process 4.2.4 [file path platform]
- pub_semver 2.1.1 [collection meta]
- pubspec_parse 1.2.0 [checked_yaml collection json_annotation pub_semver yaml]
- shared_preferences_android 2.0.11 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.0 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.0 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.3 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.3 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.0 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- shelf 1.2.0 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 1.0.1 [shelf stream_channel web_socket_channel]
- sky_engine 0.0.99
- source_gen 1.2.1 [analyzer async build dart_style glob meta path source_span yaml]
- source_span 1.8.1 [collection path term_glyph]
- sprintf 6.0.0
- stack_trace 1.10.0 [path]
- state_notifier 0.7.2+1 [meta]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timing 1.0.0 [json_annotation]
- typed_data 1.3.0 [collection]
- vector_math 2.1.1
- watcher 1.0.1 [async path]
- web_socket_channel 2.1.0 [async crypto stream_channel]
- win32 2.4.2 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.3.1 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]
- 

@asai569 asai569 added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels May 6, 2022
@darshankawar darshankawar added the triage Issue is currently being triaged. label May 6, 2022
@darshankawar
Copy link

@asai569
What's the error you are getting ? Can you provide the entire error log ?

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels May 6, 2022
@asai569
Copy link
Author

asai569 commented May 6, 2022

@darshankawar
Hello
This is error .
Do you know what this is saying?


✓  Built build/app/outputs/flutter-apk/app-dev-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...                 5.4s
Syncing files to device sdk gphone64 x86 64...                  
lib/config.dart:65:25: Warning: Operand of null-aware operation '??' has type 'int' which excludes null.
  int get androidSdk => _androidSdk ?? 0;
                        ^
Syncing files to device sdk gphone64 x86 64... 

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on sdk gphone64 x86 64 is available at: http://127.0.0.1:60310/CuwlUPngb2U=/
E/flutter (25200): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized.
E/flutter (25200): 
E/flutter (25200): Usually this means you've attempted to use a Firebase service before calling `Firebase.initializeApp`.
E/flutter (25200): 
E/flutter (25200): View the documentation for more information: https://firebase.flutter.dev/docs/overview#initialization
E/flutter (25200):     
E/flutter (25200): #0      MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:99:9)
E/flutter (25200): <asynchronous suspension>
E/flutter (25200): #1      Firebase.initializeApp (package:firebase_core/src/firebase.dart:40:31)
E/flutter (25200): <asynchronous suspension>
E/flutter (25200): #2      main (package:cherrypie/main-dev.dart:10:3)
E/flutter (25200): <asynchronous suspension>
E/flutter (25200): 
The Flutter DevTools debugger and profiler on sdk gphone64 x86 64 is available at: http://127.0.0.1:9102?uri=http://127.0.0.1:60310/CuwlUPngb2U=/

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels May 6, 2022
@darshankawar
Copy link

@asai569
This issue seem to have been fixed just recently: #8566
So look for latest plugin version in pub.dev and try it once it is availabe to see the fix.

@darshankawar darshankawar added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels May 9, 2022
@ChurikiTenna
Copy link

ChurikiTenna commented May 11, 2022

Hi, I am having same issue..

dependencies:
firebase_core: ^1.16.0

Code Below

WidgetsFlutterBinding.ensureInitialized();
  debugPrint('initializeApp');
  await Firebase.initializeApp();
  debugPrint('didinitializeApp');
  • didinitializeApp does not appear on the console. Only initializeApp does.

The latest version seems to be 1.16.0 released 7 days ago.
Am I missing something?
Sorry for the trouble.

@google-oss-bot
Copy link

Hey @asai569. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label May 20, 2022
@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@asai569 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@darshankawar darshankawar added resolution: no-response Customer did not respond after some time. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. triage Issue is currently being triaged. labels May 31, 2022
@srihariash999
Copy link

srihariash999 commented Jun 5, 2022

@darshankawar i tried today using 1.17.1 which is the latest on pub.dev and I am still getting the same error.

E/flutter ( 9393): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized.
E/flutter ( 9393):
E/flutter ( 9393): Usually this means you've attempted to use a Firebase service before calling Firebase.initializeApp.
E/flutter ( 9393):
E/flutter ( 9393): View the documentation for more information: https://firebase.flutter.dev/docs/overview#initialization
E/flutter ( 9393):
E/flutter ( 9393): #0 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:113:9)
E/flutter ( 9393):
E/flutter ( 9393): #1 Firebase.initializeApp (package:firebase_core/src/firebase.dart:40:31)
E/flutter ( 9393):
E/flutter ( 9393): #2 main (package:moneyboi/main.dart:25:3)
E/flutter ( 9393):
E/flutter ( 9393):

my initialization code is just one line :

void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}

not sure what I am doing wrong. Also, I am using Flutter v3.0.1 if that is required knowledge.

@firebase firebase locked and limited conversation to collaborators Jul 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed-by-bot resolution: no-response Customer did not respond after some time. Stale Issue with no recent activity type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants