Skip to content

Flavors vs feature flags: shipping several versions of the same app and when to use each

A flavor is decided at build time, a feature flag while the app runs. How each works on Android, iOS, Flutter, Expo and the web, a table of the alternatives and the traps.

Ramon Gomes 18 min read Level: Intermediate

Also available in: Español, Français, Português

I used flavors before I knew the name. In ManiVez, the scheduling app for manicurists that I maintain, my test phone has two identical icons: "ManiVez" is the store version, "ManiVez (dev)" is the one I install for testing, pointing to a different database and using test payment keys. Both come from the same code. And inside the store app there are 14 switches I turn on and off from the Firebase console, without publishing anything.

The first one is a flavor. The switches are feature flagsConfigurable switch that turns a feature on or off without shipping new code, so you can roll out gradually, test with a group or roll back fast.. They look like the same idea, "several versions of the same app", and that's where the confusion starts. This post separates the two, shows how each one works on Android, iOS, Flutter, React Native and the web, and ends with a simple way to decide.

What a Flavor Is

The Android docs define three pieces (Android Developers):

  • Build type is how the app gets compiled: debug (debugger attached, no optimization) and release (optimized, signed for the store). Android Studio creates both for you.
  • Product flavor is which version of the product comes out: free and pro, dev and prod, brandA and brandB.
  • Build variant is the cross of the two. You don't configure the variant; it comes from the combination. dev + debug becomes devDebug.
Build variant matrix: two flavors crossed with two build types produce four variants
Ice cream shop counter with four tubs of different flavors and a clerk with her back turned, reaching for cones
Flavor as in ice cream flavor, and that's the whole analogy: one base, and the flavor is chosen before it goes into the tub. Once it's done, pistachio doesn't turn into strawberry.

The name fits. In an ice cream shop, the base is the same and the flavor is decided during production. Once the ice cream is in the tub, it doesn't change. A flavor works the same way: decided at build time, baked into the binary. To switch, you build another one.

What a flavor usually changes:

What changes Example Why it has to happen at build time
App identifier br.com.app and br.com.app.dev it's what lets you install both at once
Name and icon "App (dev)" with a different color icon the OS reads them before the app opens
Endpoints and public keys staging API, test payment key keeps a test from charging real money
Native SDKs analytics only in prod native code can't be switched on and off later
The whole brand one base app, one version per client (white-label) each brand ships to the store as its own app

On Android

In the module's build.gradle.kts:

kotlin
android {
    buildFeatures { buildConfig = true } // off by default since AGP 8.0

    flavorDimensions += listOf("ambiente")
    productFlavors {
        create("dev") {
            dimension = "ambiente"
            applicationIdSuffix = ".dev"
            versionNameSuffix = "-dev"
            buildConfigField("String", "API_URL", "\"https://api-dev.exemplo.com\"")
            resValue("string", "app_name", "My App (dev)")
        }
        create("prod") {
            dimension = "ambiente"
            buildConfigField("String", "API_URL", "\"https://api.exemplo.com\"")
            resValue("string", "app_name", "My App")
        }
    }
}

In code, BuildConfig.API_URL already holds the flavor's value. To build, run ./gradlew assembleDevDebug or ./gradlew bundleProdRelease: the task name is the variant name in camelCase (Android Developers). If your strings.xml already has an app_name, remove it, or the build will complain about a duplicate resource.

Two details trip up beginners. First: since Android Gradle Plugin 8.0, from April 2023, the BuildConfig class is no longer generated by default; without buildConfig = true, your buildConfigField just doesn't show up (AGP 8.0 release notes). Second: each flavor can have its own code and resource folder, like src/dev/res/ with a different icon. The docs themselves suggest this for "changing the branding of your app for different clients".

On iOS, Flutter and React Native

Native iOS doesn't use the word flavor. The equivalent is a combination of scheme (what you pick at the top of Xcode), build configuration (Debug-dev, Release-prod) and an .xcconfig file tied to each configuration, holding the bundle identifier and that environment's variables (Xcode Help).

Flutter took both the name and the command: flutter run --flavor dev and flutter build appbundle --flavor prod (Flutter). On the Android side, under the hood, these are the same Gradle product flavors. On the iOS side, the docs tell you to create one scheme per flavor, with Debug-dev, Profile-dev and Release-dev configurations, and to mark the scheme as shared (Flutter, iOS). In Dart, the appFlavor constant tells you which flavor is running:

dart
import 'package:flutter/services.dart';

final apiUrl = switch (appFlavor) {
  'prod' => 'https://api.exemplo.com',
  _ => 'https://api-dev.exemplo.com',
};

pubspec.yaml also accepts per-flavor assets, so a file only goes into one brand's build (pubspec). And there's an important limit: flavors don't exist on Flutter web. The Flutter team said in an issue that there are no plans to add them (flutter#66486). On the web, the way to go is --dart-define=API_URL=... read with String.fromEnvironment, which also works on mobile and is fine for simple values.

React Native with Expo calls them app variants. app.config.ts reads a variable and decides the name and package; each profile in eas.json sets the value (Expo). That's what I use in ManiVez:

ts
// app.config.ts
const isProd = process.env.APP_VARIANT === 'production';

if (isProd && process.env.EXPO_PUBLIC_REVENUECAT_KEY?.startsWith('test_')) {
  throw new Error('Production build with the RevenueCat test key.');
}

export default ({ config }) => ({
  ...config,
  name: isProd ? 'ManiVez' : 'ManiVez (dev)',
  android: { package: isProd ? 'br.com.manivez.app' : 'br.com.manivez.app.dev' },
});

That throw is the part that saved me the most. A flavor is the natural place to block a production build when a key is missing or a test key slipped through, before the mistake reaches someone paying. I compared each stack's approach in React Native vs Flutter in 2026.

On the Web and in PWAs: The Same System for Another Country

On the web almost nobody talks about flavors, because the mobile reason for them doesn't exist: no store, no review, no two icons on a phone. Shipping a new version takes minutes. But the need shows up all the same. A friend of mine did exactly this with a web system: the Brazilian version, in Portuguese, and the same codebase for another country, with another language and a few different rules. That's a flavor, it's just that nobody calls it one. On the web the usual names are per-country variant, white-label or multi-tenant.

Before picking an approach, separate two things that look like one:

  • Language is translation and formatting. You solve it with i18n: text files per language, Intl for dates and currency, one URL per language so Google can see each version. I went into detail in React i18n and Google indexing only one language. Language alone doesn't call for a flavor.
  • Country rules are behavior: currency, ID document (CPF in Brazil, NIF in Portugal), taxes, payment methods, address fields, legal copy. That's the part that becomes a variant.

The pattern that works is to gather the rules into one object per country and have the rest of the code ask it, instead of scattering if (country === 'BR') across the system:

ts
// countries.ts
export const COUNTRIES = {
  BR: { locale: 'pt-BR', currency: 'BRL', document: 'CPF', validateDocument: validateCpf },
  PT: { locale: 'pt-PT', currency: 'EUR', document: 'NIF', validateDocument: validateNif },
} as const;

export const country = COUNTRIES[import.meta.env.VITE_COUNTRY as keyof typeof COUNTRIES];

// on any screen
new Intl.NumberFormat(country.locale, { style: 'currency', currency: country.currency }).format(total);

Intl.NumberFormat already knows how to write "R$ 1.234,50" for Brazil and "1234,50 €" for Portugal (MDN), so the screen doesn't need to know about any country.

From there, there are two ways to pick which country is running.

One build per country, the web's flavor. In Vite, vite build --mode pt loads .env.pt, and import.meta.env gets replaced with the fixed value during the build (Vite). Each country becomes a deploy on its own domain. The upside is that one country's code never even reaches the other: since the value is a constant, the bundler drops the branches that don't apply. The cost is one build and one deploy per country. In Next.js the same goes for variables prefixed with NEXT_PUBLIC_, inlined into the JavaScript at build time and frozen there (Next.js). If you build a Docker image and want to promote the same image from staging to production, the wrong value goes along with it.

A single build, country decided at runtime, the multi-tenant way. The server looks at the incoming domain (app.com.br or app.pt) and loads that country's config. A new country becomes a config entry, not a new deploy. Next.js has a guide and a Vercel example project for this case (Next.js, multi-tenant). The price is that all the code goes to everyone, and a bug in reading the domain shows one country's rules in the other.

Rule of thumb: few countries with very different rules, one build per country. Many clients or brands with the same rules and only colors, logo and copy swapped, a single build with per-domain config. And feature flags stay useful in both cases, to turn a feature on in one country before the other.

What if it's a PWA? Then the flavor looks like an app again, because each variant can be installed on the home screen. Each one needs its own manifest.webmanifest, with its own name, icons, theme_color, start_url and scope. The browser identifies the installed app by the manifest's id and, if there isn't one, by start_url (MDN). web.dev strongly recommends putting independent PWAs on separate origins, like br.app.com and pt.app.com: on the same domain, separated only by folder, they share storage and permissions, and with nested folders the browser doesn't even treat them as different apps (web.dev). In other words, a PWA per country needs a domain or subdomain per country, with the manifest generated in each one's build.

One last nuance comes from the twelve factors: config lives in environment variables, and one codebase has many deploys (12factor). The same text says that several apps sharing the same code is a sign the shared part should become a library. In practice: as long as the difference between countries fits in a config object, it's a flavor. When each country starts getting its own screens and flows, it's time for a monorepoSingle repository that holds several related projects or packages, such as apps and shared libraries, with common versioning and tooling., with a shared package and one app per country.

If your product is still deciding between web and app, I wrote about that in PWA vs native app.

What a Feature Flag Is

A feature flag is an if whose value comes from outside the code. The reference text is still Pete Hodgson's on Martin Fowler's site, revised in 2017 (Feature Toggles), which splits them into four types:

Type What it's for How long it lives
Release ship half-done code, turned off days or a few weeks
Experiment A/B test, half see A, half see B as long as the experiment
Ops an off switch for a heavy or unstable part (kill switch) can be permanent
Permissioning a feature only for paid plans, beta testers or employees permanent
Hand switching off a breaker in an open electrical panel, with one room dark and another lit down the hallway behind it
A feature flag is the breaker: the wiring stays the same, you just cut power to one room. Nobody calls an electrician to turn off the kitchen lights.

On mobile this matters even more, because a fix takes days to get through store review and more days for people to update. A flag turns off the broken feature in minutes, even on the phone of someone who never updates.

In ManiVez the flags live in Firebase Remote Config. The safest way I found to read them:

ts
const config = getRemoteConfig();
config.settings = {
  minimumFetchIntervalMillis: __DEV__ ? 0 : 12 * 3_600_000,
  fetchTimeoutMillis: 10_000,
};
await activate(config);              // apply what was already downloaded
fetchConfig(config).catch(() => {}); // fetch the new values for the next launch

Three decisions in there. New values only take effect on the next launch, so nothing changes in the middle of what the person is doing. The 12-hour interval is Firebase's default, and it throttles clients that fetch too often (Firebase). And every flag has a default value built into the app, so with no network or with Firebase down, the app runs on the defaults.

Firebase isn't the only option. LaunchDarkly is the best-known paid service; Unleash (AGPL), Flagsmith (BSD) and GrowthBook (MIT, with enterprise parts licensed separately) are open source and can run on your own server. OpenFeature, a CNCF incubating project since December 2023, standardizes the API: your code calls OpenFeature and the vendor becomes a swappable detail.

Flavor, Flag and the Other Options, Side by Side

Flavor Build variable Feature flag Over-the-air update Separate apps
When it's decided at build time at build time while the app runs when the bundle downloads in the project
Changes package, icon, native code yes no no no yes
Rolling back new build and store new build minutes minutes (JS and assets only) new build and store
Installs side by side yes no n/a n/a yes
Cost that grows build combinations .env files forgotten flags in the code runtime versions duplicated code

An over-the-air update (EAS Update, in Expo) swaps JavaScript and images without going through the store, but it doesn't touch native code. It doesn't replace flags or flavors: it quickly fixes what's already published. Left out of this comparison is server-driven UI, where the server sends the finished screen. It answers a different question, changing layout without shipping, and it costs a whole architecture.

Decision diagram: which question leads to a flavor, build variable, feature flag, over-the-air update or separate apps

When to Use Each

Use a flavor when the difference has to exist before the app opens:

  • installing dev and production on the same phone, so you can test without fear of touching real data;
  • keeping test payment keys, analytics and database apart from production;
  • building different branded versions from the same code, each with its own icon and store page;
  • free and paid versions as separate apps (these days a single app with a subscription is more common, and then it becomes a permissioning flag).

Use a feature flag when the difference depends on who's using it or when:

  • shipping code before the feature is ready, turned off, and avoiding a long-lived branch;
  • releasing to 5%, watching the error dashboard, and only then to everyone;
  • A/B testing;
  • turning off an integration that went down without waiting for the store;
  • unlocking features by plan.

And use both together, which is the most common case. In ManiVez, the flavor separates dev from production and the flags control each feature inside each one. The dev flavor can even ship with every flag on, so I can test what's still hidden in the store build.

The Traps

Cartoon of a frazzled developer facing a wall full of charging phones, each with a different colored icon, and spilled coffee on the floor
Three environments, four brands and two build types: 24 variants. Someone is going to have to test all of them before Friday.

Too many flavors multiply builds. Each dimension multiplies the others. The Android docs' own example, with three API levels, two modes and two build types, already gives you 12 variants. Turn off the combinations nobody uses with androidComponents { beforeVariants { ... } } and stick to a single dimension for as long as you can. Every variant that ships to the store needs testing; I covered how to organize that pyramid in front-end testing.

Flavors don't keep secrets. Anything that goes into BuildConfig, .xcconfig, EXPO_PUBLIC_, VITE_ or NEXT_PUBLIC_ ends up inside the APK or the JavaScript, and anyone can pull it out. Only public keys belong there: URLs, analytics IDs, the publishable payment key. Secret keys stay on the server.

A forgotten flag becomes debt, and sometimes a disaster. On August 1, 2012, the trading firm Knight Capital deployed new code that reused an old flag: it turned on a function called Power Peg, unused since 2003. One of the eight servers didn't get the new code. With the flag on, that server brought the old function back to life and, in about 45 minutes, sent more than 4 million orders and lost more than $460 million, according to the SEC. Hence Hodgson's rules: release flags get an expiration date, their removal goes into the backlog the day the flag is created, and you never reuse the name of a dead flag.

The store looks at what you hide. App Store guideline 2.5.2 forbids downloading code that adds or changes functionality, and 2.3.1 asks that every new feature be described in the review notes (Apple). In general, a flag that turns on an already reviewed feature is fine. A flag used to hide from the reviewer something they would reject is grounds for removing the app. Google Play has a similar rule and only allows downloaded code when it runs in an interpreter, like JavaScript in a webview (Google Play).

A client-side flag isn't access control. Hiding the paid-plan button with a flag is UI. Who paid and who didn't gets decided on the server, or someone tampers with the response and unlocks everything.

Frequently Asked Questions

What is a flavor on Android?

It's a product flavor: a version of the app defined in build.gradle, with its own package, name, icon, resources and values. Crossed with the build type (debug or release), it produces a build variant, like devDebug or prodRelease.

What's the difference between a flavor and a build type?

The build type says how the app is compiled (with a debugger or optimized for the store). The flavor says which version of the product comes out (dev or prod, brand A or brand B). The final variant is the combination of the two.

What's the difference between a flavor and a feature flag?

A flavor is decided at build time and changes the binary; to switch, you have to publish another version. A feature flag is decided while the app runs, by a value that comes from outside, and changes behavior without a new version.

Does Flutter have flavors?

Yes, for Android, iOS, macOS, Linux and Windows, with flutter run --flavor and the appFlavor constant. They don't exist on Flutter web; the way to go there is --dart-define with String.fromEnvironment.

Can I use flavors in a web app or PWA?

Yes. The equivalent is one build per variant, with vite build --mode and one .env per country or brand, or a single build that picks the variant from the domain. In a PWA, each installable variant needs its own origin and a manifest with its own name, icons and start_url.

How do I set up flavors in React Native?

In Expo, with app variants: app.config reads a variable like APP_VARIANT and changes the name and package, and each profile in eas.json sets the value. In a bare React Native project, set up product flavors in Gradle and schemes in Xcode.

Can I store a secret key in a flavor?

No. Everything that goes into the build ends up inside the app and can be extracted. Flavors are for public keys and URLs; secret keys stay on the server.

Are feature flags allowed on the App Store?

Yes, when they turn on features that already went through review. Apple forbids downloading code that changes functionality and asks that new features be described in the review notes; using a flag to hide something from the reviewer can get the app pulled from the store.

Which tool should I use for feature flags?

To start out in an app that already uses Firebase, Remote Config does the job at no extra cost. For experiments and rollouts with more control, LaunchDarkly, Unleash, Flagsmith or GrowthBook. OpenFeature keeps you from getting locked into one vendor.

References

Source: https://ramongomessilva.com.br/blog/flavors-vs-feature-flags · Accessed on December 03, 2026

Share Share on LinkedIn Share on X
Cite this article

Ready-made reference, with today as the access date.

ABNT

Brazilian standard (NBR 6023). Use it in theses and academic papers submitted in Brazil.

GOMES, Ramon. Flavors vs feature flags: shipping several versions of the same app and when to use each. Ramon Gomes, 13 nov. 2026. Disponível em: https://ramongomessilva.com.br/blog/flavors-vs-feature-flags. Acesso em: 3 dez. 2026.

APA

American Psychological Association style. Common in scientific papers and journals, especially in the social, behavioral and health sciences.

Gomes, R. (2026, November 13). Flavors vs feature flags: shipping several versions of the same app and when to use each. Ramon Gomes. https://ramongomessilva.com.br/blog/flavors-vs-feature-flags

BibTeX

Format for LaTeX users (Overleaf, for example). Paste it into your .bib file or import it into Zotero or Mendeley.

@online{gomes2026flavorsvsfeature,
  author = {Gomes, Ramon},
  title = {{Flavors vs feature flags: shipping several versions of the same app and when to use each}},
  organization = {Ramon Gomes},
  year = {2026},
  month = nov,
  date = {2026-11-13},
  url = {https://ramongomessilva.com.br/blog/flavors-vs-feature-flags},
  urldate = {2026-12-03}
}
Found a mistake?

Wrong fact, broken link, outdated information: tell me and I will fix it.

10 to 2,000 characters. If you can, point to the right source.

Only so I can reply. It never shows on any page of the site.

Written by

Ramon Gomes

Software Engineer

Full stack software engineer. I like taking a messy problem, listening to the people who live with it and shipping something that holds up day to day. These days I split my time between my own products, applied AI and client work.

Available for projects

Need Something Like This Built?

I build websites, systems, apps and AI automations, from design to deploy. Tell me what you need or see what I offer.

Related Articles