flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_core]: Unable to establish connection on channel: "dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore".

Open matokc95 opened this issue 1 month ago • 23 comments

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

matokc95 avatar Oct 27 '25 09:10 matokc95

Hi @matokc95, could you try flutter pub cache clean to see if it resolves your issue?

SelaseKay avatar Oct 27 '25 13:10 SelaseKay

Hi @matokc95, could you try flutter pub cache clean to see if it resolves your issue?

yes, I tried that. didn't work out for me.

matokc95 avatar Oct 30 '25 10:10 matokc95

Hi @matokc95, I'm unable to reproduce this. Can you reproduce this in a newly created flutter project?

SelaseKay avatar Oct 30 '25 15:10 SelaseKay

Hi, same problem here. @matokc95 did you fix it ?

SkilyFrance avatar Oct 31 '25 12:10 SkilyFrance

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).

SkilyFrance avatar Nov 03 '25 08:11 SkilyFrance

Hi @SkilyFrance, have you tried the suggested solutions above?

SelaseKay avatar Nov 03 '25 09:11 SelaseKay

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.

SkilyFrance avatar Nov 03 '25 09:11 SkilyFrance

@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.

SkilyFrance avatar Nov 03 '25 11:11 SkilyFrance

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.

SelaseKay avatar Nov 10 '25 09:11 SelaseKay

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

  1. Flutter new project

  2. FlutterFire configure

  3. 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

  4. Ensuring google-services.json is OK with SHA1 SHA256 locals stored in Firebase console

  5. Edit main function Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); runApp(const MyApp()); }

  6. Try flutter run on debug (it will be OK)

  7. Try flutter run --release ->dev.flutter.pigeon.firebase_core_platform_interface.FirebaseCoreHostApi.initializeCore error appears normally

SkilyFrance avatar Nov 10 '25 10:11 SkilyFrance

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.

SelaseKay avatar Nov 11 '25 15:11 SelaseKay

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 :

  1. FlutterFire configure

  2. Ensuring google-services.json is OK with SHA1 SHA256 locals stored in Firebase console

  3. 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 🙌

SkilyFrance avatar Nov 12 '25 09:11 SkilyFrance

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

M4dhav avatar Nov 12 '25 19:11 M4dhav

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.

SkilyFrance avatar Nov 13 '25 08:11 SkilyFrance

I tested with Flutter 3.35.2 and it worked. What Gradle, Kotlin and Java versions are you using?

M4dhav avatar Nov 13 '25 10:11 M4dhav

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 avatar Nov 14 '25 13:11 adigladi

@adigladi turning off shrinking and minify worked for me, even in release mode

M4dhav avatar Nov 15 '25 08:11 M4dhav

hi @adigladi @M4dhav @SkilyFrance @SkilyFrance can you share your pubspec.yaml...

maulikchak avatar Nov 17 '25 18:11 maulikchak

can you share your pubspec.yaml...

You can take a look at the entire project here

M4dhav avatar Nov 18 '25 07:11 M4dhav

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

rahul14rz avatar Nov 18 '25 11:11 rahul14rz

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!

google-oss-bot avatar Nov 26 '25 18:11 google-oss-bot

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

M4dhav avatar Nov 30 '25 18:11 M4dhav

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!

google-oss-bot avatar Dec 09 '25 18:12 google-oss-bot