Android - change flavor version name based on build type

前端 未结 4 888
清歌不尽
清歌不尽 2020-12-25 11:30

I want to change version name for app flavors but only if it\'s a debug build.

(e.g. debug builds will have versions like 1.0.1 D (DEBUG) 555 or 1.0.1 P (DEBUG) 555

4条回答
  •  醉梦人生
    2020-12-25 12:29

    I wanted to set a different versionName for debug build:

    android {
        applicationVariants.all { variant ->
            variant.outputs.all { output ->
                if (variant.buildType.name == 'debug') {
                    output.versionNameOverride = "1"
                }
            }
        }
    }
    

提交回复
热议问题