将 Flutter Apk 上传到 Play 商店时出现版本代码错误

Version Code Error while Uploading Flutter Apk to Play Store

Play 控制台出现错误“使用不同的版本代码”。

我什么都试过了。将 pubspec.yaml 中的版本代码更改为 2.0.1+2。然后 运行 pub get 更改 local.properties 文件中的版本代码。 Flutter Clean 然后构建版本。即使那样,Play Console 也会出错。

我也遇到了同样的问题,后来才知道我的version code是在我的build.gradle文件中静态定义的

转到 Android -> 应用程序 -> build.gradle 文件

并从那里更改它 请检查您的 build.gradle 文件,version Code 是来自 flutterVersionCode 还是已定义 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
}