From a3b505c001f4d85736c12d17e516110ae37d7873 Mon Sep 17 00:00:00 2001 From: Hassnaa Mohamed <112468126+Hassnaa9@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:02:10 +0300 Subject: [PATCH] Docs: Fix flutter build command for Android flavors --- src/content/deployment/flavors.md | 41 +++++++++++++++++-------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/content/deployment/flavors.md b/src/content/deployment/flavors.md index f33b175df8..7f3aec740d 100644 --- a/src/content/deployment/flavors.md +++ b/src/content/deployment/flavors.md @@ -144,26 +144,31 @@ the following steps: with developer options enabled. 1. In the console, navigate to the `flavors_example` - directory and enter the following command: + directory and use the appropriate command. - ```console title="console" - $ flutter (run | build) --flavor - ``` - - * `(run | build)`: Replace this with one of the - following: - * `run`: Run the app in debug mode. - * `build`: Run the app in production mode. - - * ``: Replace this with the name of your - Android product flavor (for example, `staging` or - `production`). + - **To run the app in debug mode on a specific flavor:** + ```console title="console" + $ flutter run --flavor + ``` + Example: + ```console title="console" + $ flutter run --flavor staging + ``` - Example: + - **To build a release version for a specific flavor:** + ```console title="console" + $ flutter build --flavor --target + ``` + Example (assuming your `staging` flavor has a `main_staging.dart` entry point): + ```console title="console" + $ flutter build apk --release --flavor staging -t lib/main_staging.dart + ``` + or to build an app bundle: + ```console title="console" + $ flutter build appbundle --release --flavor staging -t lib/main_staging.dart + ``` - ```console title="console" - $ flutter run --flavor staging - ``` + The `--target` flag is used to specify the entry point file for the flavor. ## Customize configurations @@ -224,7 +229,7 @@ names for two product flavors called `staging` and `@string/app_name`. ```xml title="AndroidManifest.xml" - +