I've created 3 buildTypes at my android project:
buildTypes {
release {
signingConfig signingConfigs.release
resValue "string", "app_name", "AppName"
}
debug {
applicationIdSuffix ".debug"
resValue "string", "app_name", "AppName - DEV"
}
staging {
initWith release
matchingFallbacks = ['release']
applicationIdSuffix ".debug"
}
}
I would like to assemble my staging build type, so I ran "flutter build apk --staging", but flutter can't find that option:
Could not find an option named "staging".
Seems that Flutter build apk command "flutter build apk" supports only 3 types : debug, profile, release; and in case of using custom buildType - there's no support for that.
Is it possible to build an apk of custom BuildType?
I ended up using productFlavors:
flavorDimensions 'app'
productFlavors {
dev {
dimension "app"
resValue "string", "app_name", "AppName - DEV"
applicationIdSuffix ".debug"
}
staging {
dimension "app"
resValue "string", "app_name", "AppName - DEV"
applicationIdSuffix ".debug"
}
prod {
dimension "app"
resValue "string", "app_name", "AppName"
}
}
One solution is to use Android's own Gradle build tasks instead of using Flutter commands.
cd android/./gradlew app:buildThen after a succesfull build you should be able to find an apk for each buildType in build/app/outputs/apk/.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With