Flutter: A Firebase App named `[Default]` already exists.

Sometimes we get a bug in Flutter when we are trying to build an app.

The problem is that we can try to run flutterfire configure to try to reinitialize our apps with our Firebase project. But it wouldn't work because that command still doesn't clear all the old firebase dependencies and we are still going to encounter that error.

Steps to Resolve the error:

  1. Remove the google-services.json from your android/app folder
rm YOUR-PROJECT-DIRECTORY/android/app/google-services.json
  1. Remove the old GoogleService-Info.plist from your iOS folder:
rm YOUR-PROJECT-FOLDER/ios/Runner/GoogleService-Info.plist
  1. If you have different flavors of builds in your iOS folder:

Reconfigure with your Firebase:

Here are the final commands to reconfigure your app with your firebase and to run the final build

flutterfire configure
flutter clean
flutter pub get
flutter run