18

Can the pre-defined build-types somehow being renamed?

We use some custom build types that represent our internal staging setup (DEV/TEST/LIVE) and do not need the build in buildTypes (release/debug). Can these somehow being renamed or disabled when calling assemble?

whlk
  • 15,487
  • 13
  • 66
  • 96

2 Answers2

25
import com.android.builder.core.BuilderConstants
android.variantFilter { variant ->
    def build = variant.buildType.name
    if (build == BuilderConstants.DEBUG || build == BuilderConstants.RELEASE) {
        variant.setIgnore(true)
    }
}

Note that the very first time importing the project Android Studio will pick any variant named debug else it will pick the first build variant in alphabetical order, which may not be the one you prefer as the default.

weston
  • 54,145
  • 21
  • 145
  • 203
Kevin Brotcke
  • 3,765
  • 26
  • 34
0

One solution i have come up with is to acctually just assemble the specifics and not run assemble. Which assembles all.

Try out gradle tasks to see the possibilites

But im looking for a better solution too, one that can be defined in the gradle.build file.

vonGohren
  • 929
  • 8
  • 22