简体   繁体   English

Android Gradle Plugin 3.0.1 versionNameSuffix用Flavors尺寸覆盖

[英]Android Gradle Plugin 3.0.1 versionNameSuffix overriding with flavors dimensions

I have several flavors with 2 dimensions: 我有2种尺寸的几种口味:

    flavorDimensions "buildType", "serverType"

    prod {
        dimension "serverType"
        versionNameSuffix "-prod"
    }

    development {
        dimension "buildType"
    }

    googlePlay {
        dimension "buildType"
        versionNameSuffix "-play"
        versionName "1.1"
    }

I want googlePlay flavor to override versionNameSuffix of prod flavor but it just appends suffixes to the final version name so I have version name like '1.1-prod-play' but I want it to be like '1.1-play' . 我希望googlePlay风味重写prod风味的versionNameSuffix,但是它仅将后缀附加到最终版本名称,因此我具有像'1.1-prod-play'这样版本名称,但我希望它像'1.1-play'那样

Could someone help me to achieve this? 有人可以帮我实现这一目标吗?

Solution is to override versionName like this: 解决方案是这样覆盖versionName:

    prod {
        dimension "serverType"
        versionName globalConfig.androidVersionName + "-prod"
    }

    development {
        dimension "buildType"
    }

    googlePlay {
        dimension "buildType"
        versionName globalConfig.androidVersionName
    }

Where globalConfig.androidVersionName is defined by me variable with version name. 其中globalConfig.androidVersionName由具有版本名称的变量定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM