[firebase_core]: Unable to establish connection on channel: "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore".
Is there an existing issue for this?
- [x] I have searched the existing issues.
Which plugins are affected?
Core
Which platforms are affected?
Android
Description
Crash when calling Firebase.initializeApp()
Reproducing the issue
Exception on calling Firebase.initializeApp()
Firebase Core version
4.2.0
Flutter Version
3.35.7
Relevant Log Output
I/flutter (28539): #0 FirebaseCoreHostApi.initializeCore (package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart:301:7)
I/flutter (28539): <asynchronous suspension>
I/flutter (28539): #1 MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:29:41)
I/flutter (28539): <asynchronous suspension>
I/flutter (28539): #2 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:70:7)
I/flutter (28539): <asynchronous suspension>
I/flutter (28539): #3 Firebase.initializeApp (package:firebase_core/src/firebase.dart:78:31)
I/flutter (28539): <asynchronous suspension>
Flutter dependencies
Expand Flutter dependencies snippet
- firebase_analytics 12.0.3 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_analytics_platform_interface 5.0.3 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.6.0+3 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins]
- firebase_auth 6.1.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_auth_platform_interface 8.1.3 [_flutterfire_internals collection firebase_core flutter http meta plugin_platform_interface]
- firebase_auth_web 6.0.4 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
- firebase_core 4.2.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_platform_interface 6.0.2 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 3.2.0 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- firebase_crashlytics 5.0.3 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_crashlytics_platform_interface 3.8.14 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
Additional context and comments
No response
Hi @matokc95, could you try flutter pub cache clean to see if it resolves your issue?
Hi @matokc95, could you try
flutter pub cache cleanto see if it resolves your issue?
yes, I tried that. didn't work out for me.
Hi @matokc95, I'm unable to reproduce this. Can you reproduce this in a newly created flutter project?
Hi, same problem here. @matokc95 did you fix it ?
Hello @SelaseKay , no idea about this problem ? I have also checked my SHA1/SH256, all is OK (I have already submitted +10 versions on PlayStore before this problem).
Hi @SkilyFrance, have you tried the suggested solutions above?
Hi @SelaseKay, yes, I tried that. didn't work out for me.
I have seen solutions about minifyEnabled false shrinkResources false but not works for me.
There is something on proguard-rules.pro to do ?
No issue on debug, only on release.
@SelaseKay , I have tried with new repo (with new .gradle.kts), and same problem. There is a serious problem with the config ... I'm stuck on it for 3 days, nothing works.
Hi @SkilyFrance, I suspect the issue originates from your proguard-rules.pro config. Have you tried running the app without it? You could provide a reproducible example in the form of a repo I can clone to investigate further.
Hi @SelaseKay , yes with and without. I have tried all suggestions fix in all threads about this dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore error.
Your can try by reproduce these steps :
[✓] Flutter (Channel stable, 3.35.7, on macOS 15.6.1 24G90 darwin-x64, locale en-FR) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 16.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.3) [✓] VS Code (version 1.105.1) [✓] Connected device (3 available) [✓] Network resources
-
Flutter new project
-
FlutterFire configure
-
Add all these packages
firebase_auth: ^6.1.2 cloud_firestore: ^6.1.0 firebase_core: ^4.2.1 firebase_storage: ^13.0.4 firebase_ai: ^3.5.0 firebase_analytics: ^12.0.4 -
Ensuring google-services.json is OK with SHA1 SHA256 locals stored in Firebase console
-
Edit main function
Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); runApp(const MyApp()); } -
Try flutter run on debug (it will be OK)
-
Try
flutter run --release->dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCoreerror appears normally
Hi @SkilyFrance, I'm still unable to reproduce this following your steps. It will best if you can create a minimal repository reproducing this so we can investigate further.
Hi @SelaseKay ,
You can try with this repo : error_firebase_pigeon
Flutter / Dart configuration
[✓] Flutter (Channel stable, 3.35.7, on macOS 15.6.1 24G90 darwin-x64, locale en-FR) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 16.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.3) [✓] VS Code (version 1.105.1) [✓] Connected device (3 available) [✓] Network resources
I already added firebase packages, you can try by following these steps :
-
FlutterFire configure -
Ensuring google-services.json is OK with SHA1 SHA256 locals stored in Firebase console
-
Edit main function
Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); runApp(const MyApp()); }
Try flutter run on debug (it will be OK)
Try flutter run --release -> dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore error appears normally
Thanks for help 🙌
Hey @SkilyFrance , try flutter clean after turning off shrinking and minify, that worked for me
As a side note, @SelaseKay is there a better alternative to fix this than turning off these options as they will cause the bundle size to expand a lot
Hi, i have some news.
@M4dhav , I have already tried it (shrinking/minify/proguard rules), nothing works.
@SelaseKay , I have fixed this issue by downgrading my flutter SDK to 3.27.4 with dart SDK 3.6.2.
I have chosen this version because this is the latest version before dart upgrades to 3.7.0.
I think there is a compatibility issue with Flutter 3.35.7 (stable channel) and possibly with an earlier version.
This issue requires further study.
I tested with Flutter 3.35.2 and it worked. What Gradle, Kotlin and Java versions are you using?
We have the exakt same issue, works in debug but not in release mode
sdk: '>=3.8.0 <4.0.0'
flutter: '3.38.0'
firebase_core: ^4.2.1
@adigladi turning off shrinking and minify worked for me, even in release mode
hi @adigladi @M4dhav @SkilyFrance @SkilyFrance can you share your pubspec.yaml...
I'm not entirely sure if it's the same root cause, but a similar issue occurred with the shared_preferences package. You can take a look at this discussion for reference: https://github.com/flutter/flutter/issues/153075#issuecomment-3313363609
Hey @matokc95. 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!
I'm not entirely sure if it's the same root cause, but a similar issue occurred with the shared_preferences package. You can take a look at this discussion for reference: flutter/flutter#153075 (comment)
I think this might indeed be the issue. I will try and verify this if I get the chance
Hey @matokc95. 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!