Unable to change build variant in android studio

830 views Asked by At

I have a list of build variants in my project and the default selected is the first one in the top of the list, when I change to the variant i want it again defaults to the first one,

i tried sync project with gradle files, clean project, invalidate chaches and restart, I also restarted mac just in case but the same thing happens.

I do not see any errors either,

as a note, there are two modules in the project and in the build varients sections the module is always the one which I donot want and I cannot change the module, i am thinking changing the variant should change the module automatically to the right one. but build variant i cannot change

Any clues on what I can do to resolve this please

gradle settings

include(":core", ":chatbot")

applicationVariants.all {
    val mergedFlavor = (mergedFlavor as com.android.build.gradle.internal.core.MergedFlavor)
    mergedFlavor.applicationIdSuffix = ""
    when(name) {
"xxxxxHomeProdRelease" -> mergedFlavor.applicationId = "io.xxxxx.android"
"xxxxxHomeProdDebug" -> mergedFlavor.applicationId = "io.xxxxx.android"
"xxxxxHomeDevRelease" -> mergedFlavor.applicationId = "io.xxxxx.android.dev"
"xxxxxHomeDevDebug" -> mergedFlavor.applicationId = "io.xxxxx.android.dev"
"xxxxxHomeLocalRelease" -> mergedFlavor.applicationId = "io.xxxxx.android.local"
"xxxxxHomeLocalDebug" -> mergedFlavor.applicationId = "io.xxxxx.android.local"
"xxxxxPublicProdRelease" -> mergedFlavor.applicationId = "io.xxxxx.android.public"
"xxxxxPublicProdDebug" -> mergedFlavor.applicationId = "io.xxxxx.android.public"
"xxxxxPublicDevRelease" -> mergedFlavor.applicationId = "io.xxxxx.android.public.dev"
"xxxxxPublicDevDebug" -> mergedFlavor.applicationId = "io.xxxxx.android.public.dev"
"xxxxxPublicLocalRelease" -> mergedFlavor.applicationId = "io.xxxxx.android.public.local"
"xxxxxPublicLocalDebug" -> mergedFlavor.applicationId = "io.xxxxx.android.public.local"
"evcPublicProdRelease" -> mergedFlavor.applicationId = "io.xxxxx.evc.android"
"evcPublicProdDebug" -> mergedFlavor.applicationId = "io.xxxxx.evc.android"
"evcPublicDevRelease" -> mergedFlavor.applicationId = "io.xxxxx.evc.android.dev"
"evcPublicDevDebug" -> mergedFlavor.applicationId = "io.xxxxx.evc.android.dev"
"evcPublicLocalRelease" -> mergedFlavor.applicationId = "io.xxxxx.evc.android.local"
"evcPublicLocalDebug" -> mergedFlavor.applicationId = "io.xxxxx.evc.android.local"
    else -> {
            println("configureVariant: $name")
        }
    }
}

productFlavors {
    create("xxxxx") {
        dimension = "brand"

        applicationId = "io.xxxxx.android"
        manifestPlaceholders["DeepLinkBrand"] = "/xxxxx"
    }
    create("evc") {
        dimension = "brand"

        applicationId = "io.xxxxx.evc.android"
        manifestPlaceholders["DeepLinkBrand"] = "/evc"
    }
    create("home") {
        dimension = "type"

        versionCode = 1231271
        versionName = "1.23.1"
    }
    create("public") {
        dimension = "type"
        versionCode = 1231271
        versionName = "1.23.1"
    }
    create("local") {
        dimension = "server"

        applicationIdSuffix = ".local"
        manifestPlaceholders["ClearTextEnabled"] = true
    }
    create("dev") {
        dimension = "server"

        applicationIdSuffix = ".dev"
        manifestPlaceholders["ClearTextEnabled"] = false
    }
    create("prod") {
        dimension = "server"

        manifestPlaceholders["ClearTextEnabled"] = false
    }
}

I am not sure what other code will e useful, please let me know if anything will be useful

thanks R

0

There are 0 answers