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

[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp( #16987

Open
1 task done
famousuniverse opened this issue Jan 18, 2025 · 4 comments
Open
1 task done
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: android Issues / PRs which are specifically for Android. plugin: core type: bug Something isn't working

Comments

@famousuniverse
Copy link

famousuniverse commented Jan 18, 2025

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Messaging

Which platforms are affected?

Android

Description

using:
firebase_core: ^3.10.0
firebase_messaging: ^15.2.0

already have:
`Future main() async {

WidgetsFlutterBinding.ensureInitialized();
try {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);

} catch (e) {
print("Firebase initialization failed: $e");
}`

seems to be only happening in android, not web and not ios.

Reproducing the issue

flutter run -d 'emulator-5554' --dart-define=ENV=production --debug | grep -v "I/MESA"

Firebase Core version

^3.10.0

Flutter Version

3.27.2

Relevant Log Output

══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following FirebaseException was thrown during a scheduler callback:
[core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()

When the exception was thrown, this was the stack:
#0      MethodChannelFirebase.app (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:195:5)
#1      Firebase.app (package:firebase_core/src/firebase.dart:79:41)
#2      FirebaseMessaging.instance (package:firebase_messaging/src/messaging.dart:32:47)
#3      new PushNotificationService (package:famous/services/push_notifications_service.dart:22:66)
#4      main.<anonymous closure> (package:famous/main.dart:164:31)
#5      _CreateInheritedProviderState.value (package:provider/src/inherited_provider.dart:736:36)
#6      _InheritedProviderScopeElement.value (package:provider/src/inherited_provider.dart:590:33)
#7      Provider.of (package:provider/src/provider.dart:303:37)
#8      MyApp.build.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:famous/main.dart:386:28)
#9      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#10     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1331:11)
#11     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1040:9)
#12     PlatformDispatcher.scheduleWarmUpFrame.<anonymous closure> (dart:ui/platform_dispatcher.dart:845:16)
#16     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
(elided 3 frames from class _Timer and dart:async-patch)

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

AND AND

noticed this too:
I/flutter (14995): Firebase initialization failed: PlatformException(channel-error, Unable to establish connection on channel., null, null)

@famousuniverse famousuniverse added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Jan 18, 2025
@famousuniverse
Copy link
Author

Making an assumption this has to do with a flutter SDK update?

@SelaseKay SelaseKay added plugin: core platform: android Issues / PRs which are specifically for Android. labels Jan 20, 2025
@SelaseKay
Copy link
Contributor

Hi @famousuniverse, I'm unable to reproduce this issue. Could you share a complete example replicating this?

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jan 20, 2025
@famousuniverse
Copy link
Author

running:
flutter run -d 'emulator-5554' --dart-define=ENV=development --debug | grep -v 'I/MESA'

on a basic app setup, gets:
I/flutter ( 5547): [IMPORTANT:flutter/shell/platform/android/android_context_vk_impeller.cc(60)] Using the Impeller rendering backend (Vulkan).
E/flutter ( 5547): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)

With a main.dart file of:
`

import 'package:nameofproject/firebase_options.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';

Future main() async {
WidgetsFlutterBinding.ensureInitialized();

// Force Firebase initialization first
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);

}`

and pubspec.yaml:
firebase_core: ^3.10.0 firebase_messaging: ^15.1.2 firebase_core_web: ^2.17.0

If this helps

@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 Jan 21, 2025
@SelaseKay
Copy link
Contributor

By "complete example," I mean a GitHub repository. Please create a new project with minimal code that reproduces the issue and share the link, so I can clone it and investigate further, as I’m unable to reproduce it on my end.

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: android Issues / PRs which are specifically for Android. plugin: core type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants