Closed subzero911 closed 2 years ago
The problem is how I declared args. It doesn't understand "--flavor prod"
syntax.
The correct way:
{
"name": "pushka (Prod)",
"request": "launch",
"type": "dart",
"program": "lib/main-prod.dart",
"args": [
"--flavor",
"prod"
]
},
{
"name": "pushka (UAT)",
"request": "launch",
"type": "dart",
"program": "lib/main-uat.dart",
"args": [
"--flavor",
"uat"
]
},
You haven't set the proper ide configuration in your pubspec.yaml: if you set ide: 'vscode', flutter_flavorizr will generate the launchers for you.
@AngeloAvv can I turn it off by some processor directive? I want to setup this file manually.
At least launch.json generated by flavorizr loses its formatting.
Simply don't put the ide
directive in you flavorizr.yaml file
After I imported and setup flavorizr, it broke my .vscode/launch.json
Now either I choose prod or uat, it always runs prod version! Also, it grabs the previous app icon from
android/src/main/res
But when I run an app from command line
flutter run -t lib/main-uat.dart --flavor uat
it seems to work correctlySetup
My build.gradle: ```gradle def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { // ----- BEGIN flavorDimensions (autogenerated by flutter_flavorizr) ----- flavorDimensions "flavor-type" productFlavors { uat { dimension "flavor-type" applicationId "ru.gosuslugi.culture.test" resValue "string", "app_name", "Культура Тест" } prod { dimension "flavor-type" applicationId "ru.gosuslugi.culture" resValue "string", "app_name", "Культура" } } // ----- END flavorDimensions (autogenerated by flutter_flavorizr) ----- compileSdkVersion 30 lintOptions { disable 'InvalidPackage' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "ru.gosuslugi.culture" minSdkVersion 23 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.debug } } } flutter { source '../..' } dependencies { implementation 'com.yandex.android:maps.mobile:4.0.0-full' implementation 'com.huawei.hms:ads-identifier:3.4.39.302' } ``` my pubspec ```yaml flavorizr: app: android: flavorDimensions: "flavor-type" ios: flavors: uat: app: name: "Культура Тест" android: applicationId: "ru.gosuslugi.culture.test" firebase: config: ".firebase/uat/google-services-uat.json" ios: bundleId: "ru.gosuslugi.culture.test" firebase: config: ".firebase/uat/GoogleService-Info-uat.plist" prod: app: name: "Культура" android: applicationId: "ru.gosuslugi.culture" firebase: config: ".firebase/prod/google-services-prod.json" ios: bundleId: "ru.gosuslugi.culture" firebase: config: ".firebase/prod/GoogleService-Info-prod.plist" ```