Search code examples
flutterapk

Version Code Error while Uploading Flutter Apk to Play Store


Play console is giving error "Use different Version Code".

I have tried everything. Changing the version code in the pubspec.yaml to 2.0.1+2. And then running pub get Changing the version code in the local.properties file. Flutter Clean and then build the release. Even then Play Console is giving error. enter image description here


Solution

  • I Was also facing the same problem, and later got to know that my version code was defined statically in my build.gradle file.

    Go To Android -> App -> build.gradle file

    And To Change it from there Please check your build.gradle file, is the version Code coming from flutterVersionCode or is it defined statically?

    defaultConfig {
       //...
        versionCode flutterVersionCode.toInteger() //See this line, is it same as mine or you have any static version Code set there which is causing the issue.
        versionName flutterVersionName
    }