How to create different build apk for different flavour in Flutter

184 Views Asked by At

I went through many docs but still can't find the exact solution for this

I tried all the possible command

flutter build apk --flavor development --release
flutter build apk --flavor staging --release

flutter build apk --flavor production --release

flutter build apk --flavor production --release


1

There are 1 best solutions below

1
Kasymbek R. Tashbaev On

If you want apk with different app id for each flavor then you have to add applicationId property to each flavor in productFlavors in app's build.gradle

android {
    productFlavors {
        development {
            applicationId "com.example.productFlavors"
        }
        staging {
            applicationId "com.example.staging"
        }
        production {
            applicationId "com.example.production"
        }
    }
}