【问题标题】:How to dynamically increment an apk version code in Android?如何在Android中动态增加apk版本代码?
【发布时间】:2019-05-18 13:30:42
【问题描述】:

现在我在internal track 中的应用程序的版本代码为565800002,而production 中的应用程序的版本代码为291302934,它来自CircleCI build number * 100,000

我想增加两个版本号

  • internalproduction
  • 以编程方式,尤其是 internal 上的那个,但我不知道该怎么做。

【问题讨论】:

    标签: android react-native google-play fastlane


    【解决方案1】:

    您可以使用任何 groovy 函数或 def 以编程方式构建您的版本代码。

    例如,

    **
     * Use the number of seconds/10 since Dec 12 2017 as the versionCode.
     * This lets us upload a new build at most every 10 seconds for the
     * next 680 years.
     */
    def verCode = (int) (((new Date().getTime() / 1000) - 1513056598) / 10)
    

    然后在您的defaultConfig 块中,您可以使用,

    versionCode verCode
    

    【讨论】:

    • 但我还需要考虑当前在 Play 商店中的现有版本代码:``` internal : 565800002. * 如何以编程方式更改此数字?生产:291302934 ```
    猜你喜欢
    • 2011-06-23
    • 2020-07-06
    • 2013-05-01
    • 2014-11-16
    • 2011-10-09
    • 1970-01-01
    • 2016-03-12
    • 1970-01-01
    • 2017-01-27
    相关资源
    最近更新 更多