I have implemented flavors in my flutter application. When I try to build apk using this command
flutter build apk --release --flavor development -t lib/main_dev.dart
I get the following error, but on trying the above command for a second time, the apk is generated successfully.
What went wrong:
Execution failed for task ':app:mergeDevelopmentReleaseResources'.
> java.lang.IllegalArgumentException: Unable to locate resourceFile (/flutter_app/build/app/intermediates/merged-not-compiled-resources/development/release/drawable/abc_dialog_material_background.xml) in source-sets.
Here's the defination of flavors in app/build.gradle
sourceSets {
customer {
res.srcDirs = ['src/customer/res']
}
staging {
res.srcDirs = ['src/staging/res']
}
development {
res.srcDirs = ['src/development/res']
}
}
flavorDimensions "app"
productFlavors {
customer {
dimension "app"
applicationId "com.example.app"
versionCode 1
versionName "1.0"
}
staging {
dimension "app"
applicationId "com.example.app"
versionCode 1
versionName "1.0"
}
development {
dimension "app"
applicationId "com.example.app"
versionCode 1
versionName "1.0"
}
}
Default Config
defaultConfig {
applicationId "com.example.app"
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName 1.0.0
}