- Replace
android:label
value by@string/app_name
inandroid/app/src/main/AndroidManifest.xml
. - Add
productFlavors
section inandroid/app/build.gradle
file. - Create
lib/main_<target>.dart
target file.
android {
...
buildTypes {
...
}
flavorDimensions "flavor-type"
productFlavors {
<flavor> {
dimension "flavor-type"
applicationIdSuffix ".<flavor>"
resValue "string", "app_name", "<flavor>"
}
}
}
- Flavor icons are located in
android/app/src/<flavor>/res
flutter build apk --flavor <flavor> --target lib/main_<flavor>.dart
- Replace
CFBundleName
value by$(bundle_name)
in Info.plist - Open
ios/Runner.xcworkspace
with Xcode - In Xcode menu, select Product -> Scheme -> New Scheme entry to create new flavor
- Create xcconfig file
- Create
ios/Flutter/Release-<flavor>.xcconfig
that contains#include "Release.xcconfig #include "<flavor>.xcconfig
- Create
ios/Flutter/Debug-<flavor>.xcconfig
#include "Debug.xcconfig #include "<flavor>.xcconfig
- Create
ios/Flutter/<flavor>.xcconfig
that containsbundle_name = <flavor app name>
- Create
- Add xcconfig files into the project
- Right-click on "Flutter" group in the project navigator
- Select "Add Files to "Runner"..."
- Select created files from previous step
- Duplicate configurations for Release and Debug and suffix them with
-<flavor>
- Click on "Runner" in the top of project navigator.
- Ensure the Runner PROJECT is selected, not the Runner TARGET.
- Click the Editor -> Add Configuration -> Duplicate "Release" Configuration.
- Duplicate
ios/Runner/Assets.xcassets/AppIcon.appiconset
directory toios/Runner/Assets.xcassets/AppIcon-<flavor>.appiconset/
- Update
ASSETCATALOG_COMPILER_APPICON_NAME
value toAppIcon-<flavor>
in related Release and Debug configurations
flutter build ios --flavor <flavor> --target lib/main_<flavor>.dart