Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Gradle: rename/disable default build type

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?

like image 684
whlk Avatar asked Jul 21 '14 16:07

whlk


1 Answers

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.

like image 53
Kevin Brotcke Avatar answered Oct 04 '22 18:10

Kevin Brotcke