Java Android中的产品风味内部风味
我不能让产品的味道起作用。我想在味道里实现味道 例如,我有两个应用程序,通过它们我像这样声明它Java Android中的产品风味内部风味,java,android,user-interface,android-productflavors,android-flavors,Java,Android,User Interface,Android Productflavors,Android Flavors,我不能让产品的味道起作用。我想在味道里实现味道 例如,我有两个应用程序,通过它们我像这样声明它 productFlavors { abc { applicationId = "com.example.abc" versionCode 1 versionName "0.0.1" resValue "string", "app_name", "abc" manif
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"
]
}
}
现在,我希望通过使用香精来开发和生产“def”,那么我如何才能做到这一点呢?可能吗?
我要做到这一点,
productFlavors {
dev {
flavorDimensions "dev"
}
prod {
flavorDimensions "prod"
}
}
您必须将
维度移动到外部
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'
}
}
您必须将维度移动到外部
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'
}
}
我尝试过这段代码,但它给出了这个错误,Flavor'def'有未知的维度'product'。真的,你能附加完整的build.gradle文件吗?你尝试过吗?我再次检查了它的工作,但dev和prod是相同的,这是代码中的“environment”,我希望它与“dev”和“prod”不同,因为它的URL不同,我有更改“dimension”到“flavorDimensions”我已经尝试了这段代码,但它给出了这个错误,Flavor“def”有未知的维度“product”。真的,你能附加完整的build.gradle文件吗?你尝试过吗?对不起,我现在再次检查了它的工作情况,但是dev和prod是相同的,在你的代码中是“environment”,我希望它与“dev”和“prod”不同因为它的URL不同,我已经将“维度”更改为“维度”