Flutter "A Firebase App Named [DEFAULT] Already Exists": The 4-Step Fix

By · Published 2026-11-30 · Last verified 2026-11-30

What does "[core/duplicate-app] A Firebase App named "[DEFAULT]" already exists" mean in Flutter?

It means a default Firebase app already exists when your Dart code calls Firebase.initializeApp(), and the options you pass don't match it. On Android and Apple platforms, the native Firebase SDK creates a default app named [DEFAULT] on its own when it finds google-services.json or GoogleService-Info.plist. The FlutterFire source code then compares three fields of your FirebaseOptions with that native app: apiKey, databaseURL and storageBucket. If any of them differs, it throws the duplicate-app error instead of returning the existing app. So the fix is almost never "initialize twice more carefully": it's making the native config file and firebase_options.dart point at the same Firebase app. This guide was checked against the firebase_core API docs, the Firebase Flutter setup guide and the FlutterFire source on GitHub on 2026-11-30.

Grid of the 4-step Config Match Fix: compare the native google-services.json or GoogleService-Info.plist with firebase_options.dart, regenerate both from one Firebase project, run flutter clean and a cold start, name a second app only on purpose, noting the check compares apiKey, databaseURL and storageBucket and that a try/catch hides the mismatch
The 4-step Config Match Fix.

The Config Match Fix: 4 steps

Short answer: find which two configs disagree, regenerate them from one Firebase project, clean the build, and add a name only when you really need a second app.

  1. Compare the two configs. Open lib/firebase_options.dart and the native file for the platform that crashes: android/app/google-services.json (or a flavor folder such as android/app/src/dev/) and ios/Runner/GoogleService-Info.plist. Check that the API key, project ID and storage bucket are the same in both.
  2. Regenerate from one project. Delete the stale native file, then run flutterfire configure and pick the same Firebase project and apps. The CLI writes a fresh firebase_options.dart, and the native files match it again.
  3. Clean and cold start. Run flutter clean, flutter pub get and a full flutter run. A hot restart keeps the native default app alive, so it can't prove the fix.
  4. Name a second app only on purpose. If you really need two Firebase projects in one build, keep [DEFAULT] for one and give the other a name. Don't use a name to silence the error on your main app.

Why does Flutter throw duplicate-app instead of reusing the app?

Short answer: FlutterFire returns the existing default app only when its options are "roughly identical" to yours; different options mean two configs, and it refuses to guess which one you meant.

The initializeApp method in firebase_core_platform_interface handles the default app in three cases. If no native default app exists and you passed no options, it throws "no app has been created", the error covered in our guide to fixing "No Firebase App [DEFAULT] has been created". If a native default app exists and you passed options, it runs a soft check. If the options match, it returns the existing app.

The soft check compares only these fields, so these are the ones to look at:

Field comparedWhen it causes duplicate-appWhere it usually differs
apiKeyAlways comparedOld google-services.json from another project or flavor
databaseURLOnly if you pass oneRealtime Database added after the native file was downloaded
storageBucketOnly if you pass oneDefault bucket changed, or project switched

The comments in that code also explain why it's lenient: small differences, such as platform keys missing during hot reloads and restarts, shouldn't throw. A different API key isn't a small difference. It means the native layer and Dart point at different Firebase apps, often in different projects. The same comparison runs for named apps, so initializing 'secondary' twice with different options throws duplicate-app for that name too.

Two columns comparing the native default app created from google-services.json or GoogleService-Info.plist with the Dart options passed to Firebase.initializeApp, listing apiKey always compared and databaseURL and storageBucket compared only when passed
Native config versus Dart options.

Which situations cause it most often?

Short answer: a stale native config file after switching projects, flavors that share one bundle ID across projects, and calling initializeApp from more than one place.

Is wrapping initializeApp in a try/catch or checking Firebase.apps a real fix?

Short answer: no. Both hide the error, and the app keeps running against whichever config the native layer loaded.

Firebase.apps returns every app instance that has been created, so a guard like "only initialize if Firebase.apps is empty" does skip the second call. But if the native default app was built from a stale file, your Auth, Firestore and Storage calls now go to the wrong project or bucket. That shows up later as permission errors or missing data, such as the cases in our list of Firestore permission-denied causes, which are far harder to trace than the original crash. Swallowing the exception in an empty catch has the same effect. Use a guard only after the configs match, if a package you don't control initializes Firebase first.

When should you pass a name to initializeApp?

Short answer: only when the build really talks to two Firebase projects at once, for example reading a shared config project alongside the app's own project.

The firebase_core docs say the default app is created by passing no name. A named app is a secondary app: it needs its own options, and plugins only use it when you pass it in, for example FirebaseFirestore.instanceFor(app: secondaryApp). Naming your main app to dodge the error leaves [DEFAULT] built from the native file, so any plugin that uses the default instance still uses the old config. Several Stack Overflow answers suggest the name trick; it stops the crash but doesn't make the two configs agree.

// Only when you really need a second project:
final secondary = await Firebase.initializeApp(
  name: 'shared-config',
  options: SharedConfigOptions.currentPlatform,
);
Two columns comparing a try/catch or Firebase.apps check, which silences the error but may keep the wrong project, with the real fix, which makes both configs come from one project and keeps one initializeApp call
Silencing the error versus fixing it.

How do you check the fix held?

Short answer: cold-start every flavor on a real device, then confirm the app talks to the project you expect.

We build and ship Flutter apps with Firebase on Google Play at GSPTeck, giosaia's indie studio building mobile and web apps with Flutter and Firebase, and keeping dev and prod configs apart is part of every release.

FAQ

Why does the error appear only on iOS or only on Android?

Each platform has its own native config file. If only the plist or only google-services.json is stale, only that platform builds a default app that doesn't match your Dart options.

Does the error happen on Flutter web?

Web has no google-services.json or plist, so the native default app case doesn't apply. It can still appear if initializeApp runs twice with different options in the same page.

Will flutter clean alone fix it?

Only if the configs already match and an old build was the problem. If the stale native file is still in the project, the error comes back on the next cold start.

Is it safe to delete google-services.json when I use firebase_options.dart?

Only if you run flutterfire configure right after, so the native files are regenerated for the project you picked. Android builds that apply the Google services Gradle plugin fail without google-services.json, so never leave it missing.

Sources

Vertical Pinterest graphic with five points on fixing the Flutter Firebase duplicate-app error
Pinterest pin: Firebase app [DEFAULT] already exists.