安卓应用中的版本问题

用android Studio 做了一个应用,想发布在google play 里,就碰到一个版本的问题。

我上传了一个版本,更新了一点点,结果有这样一个错误:Version code 1 has already been used. Try another version code。本文就这问题的解决做个小总结。

google 这个错误,找到下面这个链接:android - Version code 1 has already been used. Try another version code - Stack Overflow

 有个答案原文这样说的:

You have two ways to solve this, if you released your bundle already, then you have to update your version code like in balu k's answer,

If you're still developing and pushed app bundle for say, testing, and then you delete it, this bundle is saved as a draft with that version code. Therefore, it says that you can't use the same version because it already sees another one with the same version name.

Here's how you fix it:

  1. Go to the release section
  2. go to app bundle explorer, in the top right you should see a dropdown button for you app version, click on it.
  3. A bottomsheet will show containing all the previous app bundles you uploaded it. Delete the one with clashing bundle version and you're good to go.

这个方法是你的版本还没发行,只想更新一下,我就是这个情况。我就照做了,ok。

后面一种方法是在安卓开发里改版本,这个链接里也有介绍,不过我没办法测试,就是找不到那个文件。 

我再查找了一下,找到方法了。

就是更改build.gradle(Module)这个文件,内容如下:

defaultConfig {
        applicationId "com.liwensoft.recognizefindtext"
        minSdk 24
        targetSdk 33
        versionCode 2	//from 1=>2
        versionName "1.1"	//1.0 => 1.1

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

只是其中一段,这样就更改了版本,更改地方看我的那个注释。

我把这签名成包后再上传,效果如下:

再回到第一种方法,只有inactive 的这种未发行包才可以删除。跟着右箭头,到了下面界面:

 

对于处于active 状态,这个delete 就不会出现。 

我是边做边总结,做一个发行还不容易,现在还是测试阶段。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值