Skip to content

flutter version code is different from version code in google play console #49544

Closed

Description

@maheshj01

When uploading app to playstore I understand that we need our app to have a unique version code for each build and in flutter the version code is said to be what follows + in pubspec.yaml.
e.g version: 1.0.0+3 has a version code of 3 but when I upload my split apk's built using
flutter build apk --split-per-abi to google play console has version code as 4003,2003&1003

image

The problem is the version codes get huge when using split apks and it doesn't seem to respect the version number specified in pubspec.yaml.

edit: The question right now is if a user wishes to deploy split apks to the playstore, How should the app versioning be handled? Since the version numbers of split apk are huge when uploaded to playstore.

I understand if I set a versionCode=3

the split apk generated will be

ARM 32-bit): 1003
ARM 64-bit: 2003
x86 64-bit: 4003

but next time I set versionCode=4, play console won't accept build variants with version code less than 4003

the split apk generated will be

ARM 32-bit): 1004
ARM 64-bit: 2004
x86 64-bit: 4004

fastlane/fastlane#15936 (comment)

Activity

  1. VladyslavBondarenko commented on Jan 27, 2020

    @VladyslavBondarenko

    Related to #39817

  2. added
    t: gradle"flutter build" and "flutter run" on Android
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Jan 27, 2020
  3. jonahwilliams commented on Feb 8, 2020

    @jonahwilliams
    Contributor

    This is the intended behavior of split APKs, for more information see:

    https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions

  4. sathya4code commented on Apr 26, 2020

    @sathya4code

    Hi, I am also facing the same issue. For some security reason i am checking the app version and send it to backend. In my backend i have the version code like 5. But when i am reading the version code using package_info i am getting the version code like 1005, 2005 and 4005. How can i get the exact version code? Any idea?

    Note: i cant use bundle. we don't have access for certificate file.

  5. sathya4code commented on Apr 27, 2020

    @sathya4code

    Hi, I am also facing the same issue. For some security reason i am checking the app version and send it to backend. In my backend i have the version code like 5. But when i am reading the version code using package_info i am getting the version code like 1005, 2005 and 4005. How can i get the exact version code? Any idea?

    Note: i cant use bundle. we don't have access for certificate file.

    Hi.. Any update regarding this?

  6. koraxis commented on May 6, 2020

    @koraxis

    Hi, --split-per-abi doesnt work with the suggestions from https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions.

    When you add split{} to the build.gradle and try to customize the versioning, --split-per-abi is still using its own default behavior of generating the versionCode

  7. danybuoy commented on May 9, 2020

    @danybuoy

    Hey, running into this too. Seems like the "intended behaviour" is for split apks to use the version code generated by flutter.gradle check line 631. This seems to override any changes I make to the version code in my app/gradle, is it possible to make this optional? @jonahwilliams

  8. added
    P3Issues that are less important to the Flutter project
    on Aug 18, 2020
  9. maheshj01 commented on Apr 20, 2021

    @maheshj01
    MemberAuthor

    Hey, running into this too. Seems like the "intended behaviour" is for split apks to use the version code generated by flutter.gradle check line 631. This seems to override any changes I make to the version code in my app/gradle, is it possible to make this optional? @jonahwilliams

    but the problem with split apk is the build number gets huge as pointed here #49544 (comment)

    nextime I upload a build the build number has to be more than 4003

  10. yohom commented on Jun 30, 2021

    @yohom

    Hey, running into this too. Seems like the "intended behaviour" is for split apks to use the version code generated by flutter.gradle check line 631. This seems to override any changes I make to the version code in my app/gradle, is it possible to make this optional? @jonahwilliams

    I made a workaround by overriding the split logic in flutter.gradle. Add this code in your android {} block. You can try it.

    project.android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.versionCodeOverride = variant.versionCode
        }
    }
    
  11. maheshj01 commented on Jun 21, 2022

    @maheshj01
    MemberAuthor

    The question right now is if a user wishes to deploy split apks to the playstore, How should the app versioning be handled? Since the version number is huge when uploaded to playstore.

  12. added
    a: releaseChallenges faced when attempting to productionize an app
    on Jun 21, 2022
  13. yusuphwickama commented on Jul 4, 2022

    @yusuphwickama

    I made a workaround by overriding the split logic in flutter.gradle. Add this code in your android {} block. You can try it.

    project.android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.versionCodeOverride = variant.versionCode
        }
    }
    

    Here is a working version for android/app/build.gradle

    android {
            ...        
            defaultConfig {
                    project.android.applicationVariants.all { variant ->
                            variant.outputs.each { output ->
                                 output.versionCodeOverride = flutterVersionCode.toInteger()
                             }
                    }
            }
    }
    
    
  14. Kingtous commented on Jun 24, 2023

    @Kingtous
    Contributor

    Hey, I'm facing the same issues from version code. The app store within our countries can only support APK. And we need to provide both of arm and arm64 version of our app with the same version code. --split-per-abi is a convenient way to build arm and arm64 artifacts in only one command, but the version code is suffixed with 1000 for arm and 2000 for arm64, and it's really strange and rejected by the app store. I understand it may be an intended behavior, I just describe what I has encountered during uploading my app to the app store :)

  15. mhkarami commented on Apr 27, 2024

    @mhkarami
  16. rusty-snake commented on Aug 26, 2025

    @rusty-snake

    Here is a working version for android/app/build.gradle

    android {
            ...        
            defaultConfig {
                    project.android.applicationVariants.all { variant ->
                            variant.outputs.each { output ->
                                 output.versionCodeOverride = flutterVersionCode.toInteger()
                             }
                    }
            }
    }
    

    Here is a working version for android/app/build.gradle.kts:

    android {
        // ...
    }
    
    androidComponents {
        onVariants { variant ->
            variant.outputs.forEach { output ->
                output.versionCode.set(flutter.versionCode)
            }
        }
    }

    Note that I'm not really understanding what I'm doing here, the snipped was created by trial-and-error-programming. Fell free to improve it.


    EDIT: This snippet does not work after the update to Flutter 3.35. Flutter 3.35.3 will fix it, see #173917.
    EDIT2: Still broken with Flutter 3.35.3.
    EDIT3: It was a Flutter 3.32 "broken feature" that allowed the workaround to work. This was fixed in Flutter 3.35 in the closed possible way. i.e. reintroduce this bug and remove the workaround. I don't think we're going to see this 5 year old issue ever solved.

  17. derdilla commented on Jun 8, 2026

    @derdilla
    Contributor

    Could we document this a little more prominently? A little "If you are using split APKs, we add 1000, 2000 or 4000 depending on the ABI" in the template build.gradle would have saved me a good half hour of confusion :)

  18. added a commit that references this issue on Jun 26, 2026
    dfbca72
  19. github-actions commented on Jul 14, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: releaseChallenges faced when attempting to productionize an appc: proposalA detailed proposal for a change to Flutterplatform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions