Getting `Could not find com.google.firebase:firebase-core:.` error in flutter add-to-app

693 Views Asked by At

I'm trying to integrate a Flutter app with the add-to-app feature following the Official documentation which is outdated as per this thread. In my Flutter part's pubspec.yaml, I have this Dependency Library - firebase_core: ^2.4.1 And in my Android Project's App level build.gradle file, I have this -

implementation(platform("com.google.firebase:firebase-bom:31.0.3"))
implementation("com.google.firebase:firebase-core")

I was using 31.2.0, but since I started getting this error, I switched to 31.0.3 since that's what Flutter's package was using.

When I run flutter build aar and Sync android project the with Gradle, I get these errors - enter image description here

And when I just try to run the app, I see this - enter image description here

2

There are 2 best solutions below

0
On

I'm having similar issue as well firebase.google.com/docs/android/setup

This page states that we don't need to add version if we use firebase-bom. firebase setup

However, if we refer to https://developers.google.com/android/guides/releases

we can see the dependencies in the firebase-bom.

For example, com.google.firebase:firebase-bom:32.8.0 doesn't have firebase-core listed.

As for firebase-bom:31.0.3

https://firebase.google.com/support/release-notes/android#2022-11-11

It doesn't include firebase-core as well.

Note: firebase update

1
On

Go to android->app->build.gradle and use implementation "com.google.firebase:firebase-core:21.1.1" instead of "com.google.firebase:firebase-core:". In my case that was the solution.