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

Issue

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"
        }
    }
}

Answered By – Nitish

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published