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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24772407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:43:57  来源:igfitidea点击:

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

androidapk

提问by Ahmad Arslan

According to this answer How to solve "Your APK's version code needs to be higher than 2." in Google Play's Developer Console?I have just changed the version code from 2 to 3 and it failed to upload the build.

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

This is my old manifest before I uploaded the apk

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

<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" />
        .....

here is the new version code which I have to upload on android developer console. See my menifest

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

<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" />
        ......

I dont know whats the issue. Any help? enter image description here

我不知道是什么问题。有什么帮助吗? 在此处输入图片说明

采纳答案by Martin Konecny

android:versionCode="28"

Your previous versionCodewas 28. You should increment it by 1 to 29.

你之前versionCode是 28。你应该把它增加 1 到 29。

android:versionCode="29"

Presumably, your previous app versions were 1 through 28. By releasing with versionCode 3, you are conflicting with a previous version of your app that was already released with this versionCode.

据推测,您之前的应用程序版本是 1 到 28。通过使用 versionCode 3 发布,您与已经使用此 versionCode 发布的应用程序的先前版本发生冲突。

回答by FFinn

For people who use Android Studio the problem may be solved by editing versionCodeand versionNamein build.gradleinstead of AndroidManifest.xml.

对于使用 Android Studio 的人,可以通过编辑 versionCodeversionNameinbuild.gradle而不是AndroidManifest.xml.

e.g.

例如

defaultConfig {
    applicationId "com.my.packageId"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 2      <-- change this
    versionName "2.0"  <-- change this
}

回答by Thecarisma

In my case it a simple issue. I have uploaded an app in the console before so i try re uploading it after resolving some issues All i do is delete the previous APK from the Artifact Library

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

回答by user2407334

if you are using ionic framework, go to config.xmlfile and change the "version"attribute in the "widget"tag. increase the version number. then rebuild, sign and upload ur apk to play store. that fixed my problem.

如果您使用ionic 框架,请转到config.xml文件并更改“widget”标签中的“version”属性。增加版本号。然后重建,签名并上传您的apk到Play商店。那解决了我的问题。

回答by Kingston Fortune

This error appears when you try to upload an apk that has same version values as the one already on playstore.

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

Just change the following in your build.gradle file => versionCode and versionName

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

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

回答by DSlomer64

In Android Studio 1.1.0, change versionCodein build.gradlefor Module: appand don't necessarily change versionName:

在Android Studio中1.1.0,变化versionCodebuild.gradleModule: app,并不一定变化versionName

android {
...
    defaultConfig {
...
        versionCode 3
        versionName "1.0"
    }
...
}

回答by bma350

Sometimes the PlayStore encounters a bug when you upload an APK during a Release creation, and you are stuck because you cannot upload the same APK again, for the current draft release. You get the error "Upload failed..."

有时PlayStore在创建Release时上传APK会遇到bug,因为当前草稿版本无法再次上传同一个APK而卡住。您收到错误“上传失败...”

The solution is to go to the Artifact librarymenu, under Release managementand to delete the draft artifact. Once this is done, you will be able to upload the APK again, and to finish your release.

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

Hope it will help others...

希望它会帮助其他人......

Ben

回答by Keale

Just as Martin Konecny's answersaid, you need to change the versionCode to something higher.

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

Your previous version code was 28. it should be changed to 29.

您之前的版本代码是28. 应该改为29.

According to the document on the android developer website.a version code is

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

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

一个整数值,表示应用程序代码相对于其他版本的版本。

So it should be related(by related I mean higher) to the previous versionCode as noted by the document:

所以它应该与文档中指出的(相关我的意思是更高)与之前的 versionCode 相关:

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

您应该确保应用程序的每个后续版本都使用更大的值。

As mentioned again in the document

正如文档中再次提到的

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)

android:versionCode 值不一定与用户可见的应用程序发布版本非常相似(请参阅下面的 android:versionName)

So even though this is the release 2.0001of your app, it does not necessarily mean that the versionCode is 2.

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

Hope this helps :)

希望这可以帮助 :)

回答by YYY

If you're using Android Studio, you could go:

如果您使用的是 Android Studio,则可以:

Build -> Edit Flavors

构建 -> 编辑风味

And change the Version Code and Name from there.

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

enter image description here

在此处输入图片说明

回答by Sanjoy Kanrar

if you are using phonegap / cordova applications, just edit your config.xml and add the android-versionCode and version in the widget.

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

<widget id="com.xxx.yyy" version="1.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" android-versionCode="100001" version="1.0.1">

<widget id="com.xxx.yyy" version="1.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ ns/1.0" android-versionCode="100001" version="1.0.1">