Android Gradle: rename/disable default build type

一笑奈何 提交于 2019-12-06 17:12:30

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/24869726/android-gradle-rename-disable-default-build-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!