Create new buildType for submodule based on parent project

I have and android project which has buildTypes configured for release, debug, dev, stag. I have a module which has buildTypes configured for release, debug. I want to add dev and stag buildType to my module while building the dev and staging build variant of app. I want to do this without adding any piece of code in the module. So that in future if I create new buildTypes or flavours, I don't have to go and change them in the individual module section. I should be able to control them either from app level or project level build.gradle file. Please help me out. I am beginner in Gradle build system. Thanks in advance.

I need something like thi:

implementation project(":sub_module"){
    android {
        buildTypes {
            dev {
                initWith debug
            }
            stag {
                initWith debug
            }
        }
    }
}

Something like this, that I can configure from app/project level build.gradle file.

Upvotes: 1

Views: 177

Answers (0)

Related Questions