Search code examples
flutterdartversion-control

Setting version for my flutter app in build.gradle file


I am getting ready to release my app for testing. I have looked into the versioning of my app and found that it is done in the app/build.gradle file. I need to know if what I have is sufficient of should I change it manually?

Here is the build.gradle file:

defaultConfig {
        applicationId "com.example.myapp"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

Should I leave this code in place or should I have something like this:

defaultConfig {
        applicationId "com.example.myapp"
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode "1.0"
        versionName "1.0_beta"
    }

Thanks


Solution

  • Instead of changing directly on app/build.gradle, you can use local.properties file. Also other files will be needed to generate release apk

    enter image description here

    More about android deployment.