Search code examples
androidfluttergoogle-playapkgoogle-play-console

How to remove the flavor name (prod/dev) from Flutter app's versionName: 1.0.0-prod?


I have an app developed with Flutter, I have the following line in my pubspec.yaml file:

version: 1.0.0+1

But when I generate an apk - the versionName becomes 1.0.0-prod. I uploaded the app to Google Play and the suffix is present there too.

Is there a way to remove the flavor name from the versionName?


Solution

  • In your app/build.gradle remove versionNameSuffix ".prod" and applicationIdSuffix ".prod"

    Current code might look something like this

    productFlavors {
            dev {
                dimension "counterapp"
                applicationIdSuffix ".dev"
                resValue "string", "app_name", "Counter App Dev"
                versionNameSuffix ".dev"
            }
            prod {
                dimension "counterapp"
                applicationIdSuffix ".prod"
                resValue "string", "app_name", "Counter App Prod"
                versionNameSuffix ".prod"
            }
        }
    }
    

    Updated code

    productFlavors {
            dev {
                dimension "counterapp"
                resValue "string", "app_name", "Counter App Dev"
            }
            prod {
                dimension "counterapp"
                resValue "string", "app_name", "Counter App Prod"
            }
        }
    }