上传我的应用程序时出现此错误:上传失败您需要为您的 APK 使用与版本代码 1 不同的版本代码

I get this error when uploading my app: Upload failed You need to use a different version code for your APK than version code 1

我在 google Play 商店上有一个应用程序。目前只有一个上传。

我想上传一个新版本,但每当我这样做时,这个错误都会显示:

Upload failed You need to use a different version code for your APK because you already have one with version code 1

不管是versioncode 1, 2 or 3. 第一次发布方式versioncode 1, this is versioncode 2.

我不知道问题出在哪里,也许我必须同步 build.gradle,我听一些人谈过这个,但我不是 100% 确定该怎么做?

此外,如果我制作一个新的 'App' 并将其上传到那里,此错误不会显示 op,那可能是因为在那 'app' 上没有其他具有该名称的应用程序版本,或任何更高。

此外,build.gradle 文件有 300 多个,我说的是目录下的那个

ApplicatioName\myApplication\build.gradle

这里是 build.gradle:

defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 2
        versionName "2.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

我该怎么办?

在 Flutter 中,至少在我的经验中,除了 pubspec.yaml 之外,您不需要在任何地方修改版本代码。假设您的 version 标签有 version: 1.0.0+1,您的 android 版本代码将为 1,您的用户可见版本名称为 1.0.0。例如,您可以将其更改为 version: 1.1.0+2,这应该可以解决您的问题。

编辑:显然,重建。