【问题标题】: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上传我的应用时出现此错误:上传失败 您需要为您的 APK 使用与版本代码 1 不同的版本代码
【发布时间】:2020-12-06 23:04:07
【问题描述】:

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

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

上传失败您需要为您的 APK 使用不同的版本代码,因为您已经有一个版本代码为 1 的版本代码

不管天气是versioncode 1、2还是3。第一种发布方式是versioncode 1,这个是versioncode 2。

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

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

另外,大约有 300 个不同的 build.gradle 文件,我说的是目录下的那个

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"
    }

我该怎么办?

【问题讨论】:

  • 我问得太天真了,但有时最简单的事情就是罪魁祸首:您是否在更改版本代码后重新创建了 APK?
  • "ApplicatioName\myApplication\build.gradle" 通常,您修改此设置的 build.gradle 位于名为 app 的子目录中。
  • versionCode 1 上的 versionName 是什么?
  • @lucidbrot 是的,我经常这样做:)
  • @Michael 哦,是的,我刚刚打开了那个文件,我没有找到 'versionName'/'versionCode'。但是有一个叫做 FlutterVersionName = '2.0' 和 FlutterVersionCode = '4' 的东西。我是否要更改这些,或者如果是,为什么默认版本代码为 4,版本名称为 2?

标签: android android-studio flutter build.gradle google-play-console


【解决方案1】:

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

编辑:显然,重建。

【讨论】:

  • 非常感谢,它起作用了:) 谢谢
猜你喜欢
  • 1970-01-01
  • 2014-09-06
  • 2015-10-21
  • 1970-01-01
  • 2017-12-19
  • 1970-01-01
  • 2021-07-24
  • 2021-02-24
  • 1970-01-01
相关资源
最近更新 更多