Android 中多维风格的应用名称

App names for Multiple Dimension Flavors in Android

提问人:refresh 提问时间:11/29/2022 最后编辑:refresh 更新时间:11/29/2022 访问量:91

问:

我在 Android 中有 4+ 构建风格和 2 个维度。

build.gradle (:应用):

flavorDimensions 'first', 'second'
productFlavors {

    // first dimension
    one {
        dimension 'first'
        manifestPlaceholders = [
            firstName: 'one'
        ]
        ...
    }
    two {
        dimension 'first'
        manifestPlaceholders = [
            firstName: 'good-app'
        ]
        // manifestPlaceholders = [
            // firstName: 'nice-app'
        // ]
        ...
    }
    ...

    // second dimension
    once {
        dimension 'second'
        manifestPlaceholders = [
            secondName: 'once'
        ]
        ...
    }

    twice {
        dimension 'second'
        manifestPlaceholders = [
            secondName: 'twice'
        ]
        ...
    }
    ...
}

Android清单(phrasefix).xml:

<application
            android:label="${firstName}-${secondName}"
    ...
>

我想为每个构建变体创建应用程序名称:

Build Variant -> App Name
oneOnceDebug -> one-once
oneTwiceDebug -> one-twice
...
twoOnceDebug -> good-app (not two/once)
twoTwiceDebug -> nice-app (not two/twice)

oneOnceDebug 和 oneTwiceDebug 没问题,但 twoOnceDebug 和 twoTwiceDebug 的名称是错误的。

如何更改 twoOnceDebug 和 twoTwiceDebug 的应用名称?

android-gradle-plugin android-manifest android-productflavors build-variant

评论


答: 暂无答案