RufusInZen
RufusInZen

Reputation: 2189

Android Studio does not show all build variants

Below are the buildTypes and flavors parts of my build.gradle:

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        applicationIdSuffix '.debug'
        versionNameSuffix '-DEBUG'
    }
}

flavorDimensions "default"
productFlavors {
    free {
        android.sourceSets.free.setRoot('src/main')
        dimension "default"
    }
    plus {
        applicationIdSuffix '.plus'
        versionName '1.0'
        android.sourceSets.plus.setRoot('src/plus')
        dimension "default"
    }
}

Android Studio only shows two build variants (freeDebug and freeRelease) in the Build variants window. It does not show plusDebug or plusRelease. I have another project with a similar build.gradle and I can clearly see four build variants. Any ideas where I should look?

Upvotes: 1

Views: 1838

Answers (2)

enl8enmentnow
enl8enmentnow

Reputation: 943

plus is a default method in groovy. It's not a bug in Android Studio or anything else. You are executing this function in DefaultGroovyMethods

public static <T> Set<T> plus(Set<T> left, T right) {
    return (Set)plus((Collection)left, (Object)right);
}

This is because the delegate passed into productFlavors implements Set.

See productFlavors definition

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1007399

This appears to be a bug/limitation in Gradle. I have filed an issue for it.

Use something else, other than plus. I tried quoting it ("plus"), thinking that perhaps it's a conflict with a keyword, but that had no effect. But Plus and plussss and phat all work.

Upvotes: 1

Related Questions