Kirill Bubochkin
1 min readJun 30, 2018

--

If I got you right, you can do smth like this:

First, create tasks as it was mentioned in productFlavors section:

all { flavor ->
task("doSomething${flavor.name.capitalize()}") {
doLast {
println "doSomething${flavor.name.capitalize()}"
}
}
}

Then add this code to the end of the build.gradle file:

afterEvaluate {
android.productFlavors.all { flavor ->
tasks."assemble${flavor.name.capitalize()}Debug".dependsOn "doSomething${flavor.name.capitalize()}"
}
}

In this case every assembleFlavorDebug task will depend on the corresponding doSomethingFlavor task.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Kirill Bubochkin
Kirill Bubochkin

Responses (1)

Write a response