关于android:上传失败,您需要为APK使用其他版本代码,因为您已经拥有一个版本代码为2的APK

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

根据此答案,如何解决"您的APK版本代码必须高于2。" 在Google Play开发者控制台中? 我刚刚将版本代码从2更改为3,但无法上传构建。

这是我上传apk之前的旧清单

1
2
3
4
5
6
7
8
9
10
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="mypackage name"
    android:installLocation="auto"
    android:versionCode="28"
    android:versionName="1.0028">

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />
        .....

这是我必须在android开发人员控制台上上传的新版本代码。 看我的清单

1
2
3
4
5
6
7
8
9
10
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="mypackage name"
    android:installLocation="auto"
    android:versionCode="2"
    android:versionName="2.0001">

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />
        ......

我不知道是什么问题。 有什么帮助吗?
enter image description here


对于使用Android Studio的用户,可以通过在build.gradle中而不是AndroidManifest.xml中编辑versionCodeversionName来解决问题。

例如

1
2
3
4
5
6
7
defaultConfig {
    applicationId"com.my.packageId"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 2      <-- change this
    versionName"2.0"  <-- change this
}


1
android:versionCode="28"

您先前的versionCode是28。您应该将其增加1到29。

1
android:versionCode="29"

大概您以前的应用程序版本为1到28。通过使用versionCode 3发行,您与已经使用该versionCode发行的应用程序的先前版本冲突。


就我而言,这是一个简单的问题。我之前在控制台中上传了一个应用程序,因此在解决了一些问题后我尝试重新上传它
我所要做的就是从工件库中删除以前的APK


如果使用的是离子框架,请转至config.xml文件并在" widget"标签中更改" version"属性。增加版本号。然后重建,签名并上传您的APK到商店。解决了我的问题。


当您尝试上载具有与Playstore上已有版本相同的版本值的apk时,会出现此错误。

只需在build.gradle文件中更改以下内容=> versionCode和versionName

1
2
3
4
5
6
7
8
9
10
11
12
defaultConfig {
    applicationId"com.my.packageId"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 2      <-- increment this by 1
    versionName"2.0"  <-- this is the version that shows up in playstore,
                           remember that the versioning scheme goes as follows.
                           first digit = major breaking changes version
                           second digit = minor changes version
                           third digit = minor patches and bug fixes.
                           e.g versionName"2.0.1"
}

有时,在创建发行版期间上传APK时,PlayStore会遇到错误,并且由于无法为当前的草稿发行版再次上传相同的APK而陷入困境。您收到错误"上传失败..."

解决方案是转到发布管理下的Artifact库菜单,然后删除草稿工件。完成此操作后,您将可以再次上传APK,并完成发布。

希望它能帮助别人...


(对于Flutter App)您需要为APK或Android App Bundle使用不同的版本代码,因为您已经拥有一个版本代码为1的版本。

不要惊慌...

您需要在pubspec.yaml文件中更改Flutter版本,并在local.properties文件中更改版本代码。

首先转到您的pubspec.yaml文件。前三行应为App的名称,说明和版本。

发行前-

对您来说,版本可能看起来像这样:

版本:1.0.0 + 1

因此,在创建要发布的apk(用于在Google Play控制台上更新现有应用程序,即进行新更新)之前,请确保将此数字增加1。(您应将其增加,因为不需要增量步骤)。

只需将该版本更改为(根据您的需要)

版本:1.0.1 + 2

其次,如果

项目-> android-> local.properties中的flutter.versionCode是

flutter.versionCode = 1然后将其更改或升级为flutter.versionCode = 2或任何其他比以前的代码大的数字。

最后根据文档发布该应用程序。


在Android Studio 1.1.0中,将build.gradle中的versionCode更改为Module: app,而不必更改versionName

1
2
3
4
5
6
7
8
9
android {
...
    defaultConfig {
...
        versionCode 3
        versionName"1.0"
    }
...
}

如果您正在使用带有Expo的Building Standalone Apps,则由于标准app.json配置仅引用了version属性,因此versionCode错误可能会逐渐蔓延。

我能够在android下添加versionCode属性,如下所示:

示例App.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
 "expo": {
   "sdkVersion":"29.0.0",
   "name":"App Name",
   "version":"1.1.0",
   "slug":"app-name",
   "icon":"src/images/app-icon.png",
   "privacy":"public",
   "android": {
     "package":"com.madhues.app",
     "permissions": [],
     "versionCode": 2 // Notice the versionCode added under android.
    }
  }
}

详细文档:https://docs.expo.io/versions/v32.0.0/workflow/configuration/#versioncode


如果您使用的是Android Studio,则可以执行以下操作:

构建->编辑风味

然后从那里更改版本代码和名称。

enter image description here


正如Martin Konecny的回答所说,您需要将versionCode更改为更高的版本。

您以前的版本代码是28。它应该更改为29

根据android开发人员网站上的文档。版本代码是

An integer value that represents the version of the application code, relative to other versions.

因此,它应该与文档中指出的先前versionCode相关(我的意思是更高):

you should make sure that each successive release of your application uses a greater value.

正如文件中再次提到的

the android:versionCode value does not necessarily have a strong resemblance to the application release version that is visible to the user (see android:versionName, below)

因此,即使这是应用程序的2.0001版本,也不一定意味着versionCode是2

希望这可以帮助 :)


如果您正在使用phonegap / cordova应用程序,则只需编辑config.xml并在小部件中添加android-versionCode和版本。


在扑

更新版本:pubspec.yaml中的1.0.0 + 1。

该应用程序的默认版本号是1.0.0。要更新它,请导航到pubspec.yaml文件并更新以下行:

1
version: 1.0.0+1

+1(+后面的数字)代表versionCode,例如1、2、3等。

所以像这样一一增加

1
version: 1.0.1+2

版本号是由点分隔的三个数字,例如上例中的1.0.0,后跟可选的内部版本号,例如上例中的1,并用+分隔。

通过分别指定--build-name和--build-number,可以在Flutter的版本中覆盖版本和内部版本号。

在Android中,内部版本名称用作versionName,而内部版本编号用作versionCode。有关更多信息,请参阅对应用程序进行版本控制

更新pubspec file中的版本号后,从项目顶部运行flutter pub get,或使用IDE中的Pub get按钮。这将更新local.properties文件中的versionNameversionCode,随后在重建Flutter应用程序时在build.gradle文件中对其进行更新。


在将flutter应用程序上载到playstore时,我收到了相同的错误,只是更改pubspec.yaml中的版本代码对我有用。可以尝试将版本代码从+1更改为+1,然后使用重新生成apk

1
flutter build apk --split-per-abi

并将所有APK上载给用户。
下次要推送更新时,请确保将版本代码更新为+3,依此类推。

Note: that the version code and version name are different you can see
that in android/local.properties file.
e.g version: 1.0.0+2

version is 1.0.0 and verison code is +2


如果您的Flutter App的Android APK出现此错误,请在defaultConfig {}下的app / build.gradle文件中

注释掉

1
2
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

并添加

1
2
versionCode 2
versionName"2"

或"旧版本代码" +1。


就我而言,我的AndroidManifest中有类似的内容,

1
2
3
4
5
6
7
      javaCompileOptions {
        annotationProcessorOptions {
            arguments = [
                    'androidManifestFile': 'app\\\\build\\\\intermediates\\\\merged_manifests\\\\debug\\\\processDebugManifest\\\\merged\\\\AndroidManifest.xml'
            ]
        }
   }

此处的" androidManifestFile"位置错误,将其更改为

1
"androidManifestFile":"$projectDir/src/main/AndroidManifest.xml".toString()

一切正常


我一直反复遇到相同的错误,

最后我使用Google Play控制台手动上传了apk文件,如屏幕截图所示。

在App Release中,您选择屏幕截图中显示的" CREATE RELEASE"按钮,然后从/android/app/bin/build/outputs/apk/release/app-release.apk

上传您的apk文件
enter image description here


在我的app / build.gradle文件中,版本代码如下:-

build.gradle(app module) file

代替versionCode flutterVersionCode.toInteger(),我将其替换为
版本代码2


这似乎是因为您已经将版本3的APK文件上传到Google Play商店。再次,您上传具有相同版本的apk。因此已发生此问题。

因此,对于解决方案,您需要更改版本名称和版本代码(以1递增)并运行一次应用程序,然后将其导出并上传到Google Play。