gpt4 book ai didi

java - Android 中的产品 flavor 内部 flavor

转载 作者:行者123 更新时间:2023-12-01 16:21:31 26 4
gpt4 key购买 nike

我无法让产品口味发挥作用。我想要实现味道里面的味道例如,我有 2 个应用程序,我是这样声明的,

 productFlavors {
abc {
applicationId = "com.example.abc"
versionCode 1
versionName "0.0.1"
resValue "string", "app_name", "abc"
manifestPlaceholders = [
appIcon : "@mipmap/ic_launcher",
appRoundIcon: "@mipmap/ic_launcher_round"
]
}
def {
applicationId = "com.example.def"
versionCode 1
versionName "0.0.1"
resValue "string", "app_name", "def"
manifestPlaceholders = [
appIcon : "@mipmap/ic_launcher",
appRoundIcon: "@mipmap/ic_launcher"
]
}
}

现在我想通过使用 flavor 来“def”进行开发和产品,那么我怎样才能实现这一目标?是否可以 ?我想实现这个目标,

 productFlavors {
dev {
flavorDimensions "dev"
}
prod {
flavorDimensions "prod"
}
}

最佳答案

您必须将 flavorDimensions 移至外部尝试此操作

    flavorDimensions 'product', 'enviroment'
productFlavors {
abc {
applicationId = "com.example.abc"
versionCode 1
versionName "0.0.1"
resValue "string", "app_name", "abc"
manifestPlaceholders = [
appIcon : "@mipmap/ic_launcher",
appRoundIcon: "@mipmap/ic_launcher_round"
]
dimension 'product'
}
def {
applicationId = "com.example.def"
versionCode 1
versionName "0.0.1"
resValue "string", "app_name", "def"
manifestPlaceholders = [
appIcon : "@mipmap/ic_launcher",
appRoundIcon: "@mipmap/ic_launcher"
]
dimension 'product'
}
dev {
dimension 'enviroment'
}
prod {
dimension 'enviroment'
}
}

关于java - Android 中的产品 flavor 内部 flavor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62259732/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com