如何第二次将应用上传到Play商店?您已经有一个版本代码为1的错误

问题描述

在分支内部测试中,我成功地将我的apk上传到了Play商店,突然间,由于以下错误,它开始拒绝我的新apk:

You need to use a different version code for your APK or Android App Bundle because you already have one with version code 1.

enter image description here

这是我的app.json被expo用来生成清单:

{
    "android": {
      "package": "com.myapp.www","versionCode": 360010305,"permissions": [
        "CAMERA_ROLL","CAMERA","LOCATION","NOTIFICATIONS","WRITE_EXTERNAL_STORAGE","READ_EXTERNAL_STORAGE"
      ]
    }
}

我使用this是因为我已经安装了semantic-release-expo,它负责在每个新发行版中为我更新app.json

由于the default已经是code,所以我想知道为什么还是会出现此错误,也许我应该将此设置更改为增量并将versionCode设置为1?

为什么我不再被允许将构建的apk(通过博览会的CIs)发布到PlayStore?

解决方法

版本代码有问题。 Play商店在您的代码中检测到先前或相同版本的代码。因此,只需将您的版本代码替换为360010306。之后即可解决您的问题。

,

如果项目中的版本代码为1,则增加为2,依此类推,以此类推 然后生成新的 APK ,然后将其再次上传到控制台

,

expo SDK36确实出现了问题,将sdkVersion上的package.json移开,导致expo-semantic-release不更新android应用程序的versionNumber

此问题已通过在我的博览会配置app.json中添加来解决:

{
  "expo": {
+    "sdkVersion": "38.0.0"
  }
}
,

将您的Build.gradle更新为:

...
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.example.yourpackage"
        minSdkVersion 21
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 360010306
        versionName "0.8.8-Alpha"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
...

对于要在控制台上上传的每个.aab或.apk文件,VersionCode必须不同,并且此数字限制为2100000000 ...值。

具体而言,您需要将版本代码更新为下一个自然数...但是,必须谨慎使用随机数进行版本化,该模式是将数字一一提升。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...