Hello! I have an Android and iOS project which currently contains about 8 productFlavors and Targets. It is a whitelabel app where each flavor contains some different resources and code (colors).
I want to migrate this to Compose Multiplatform. I immediately started with AGP 9 because I know the flavors have been removed, so wanted to get that out of the way.
I have tried two things which both didn't work. Specifically the overriding of the strings.xml in composeResources. I tried adding kotlin srcDirs and resources srcDirs based on a gradle parameter. And I also tried a module approach for android productFlavors. But when I tried using it in compose, it is still showing the result of the strings.xml inside commonMain (the main composeResources folder). I'll show an example:
In the shared module I try to use
project.findProperty("appTarget")?.toString() ?: "none"
and then add specific kotlin srcDirs and resources srcDirs like this:
val appTargetDir = "src/targets/$appTarget"
if (file(envDir).exists()) {
kotlin.srcDirs("$appTargetDir/kotlin")
resources.srcDirs("$appTargetDir/composeResources")
}
And the filetree:
androidApp
iosApp
shared
├── commonMain
│ └── composeResources
└── targets
└── myTarget
└── composeResources
Does anybody have a clue how to fix this? Also what is the best way to add this kind off flavors inside the multiplatform environment?