Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the root folders for Android productFlavors

Is it possible to change the default flavors root path?

From:

---src
-----main
-----flavor1
-----flavor2
-----flavor3

To:

---src
-----main
-----flavors
--------flavor1
--------flavor2
--------flavor3
like image 214
MTZ4 Avatar asked Dec 25 '22 20:12

MTZ4


1 Answers

And if you don't want to add a line into sourceSets every time you add a flavor you may use closure like this

productFlavors{
    flavor1 {}
    flavor2 {}

    all { flavor ->
        sourceSets[flavor.name].setRoot("src/flavors/${flavor.name}")
    }
}
like image 179
Dmitriy Rybakov Avatar answered Apr 29 '23 21:04

Dmitriy Rybakov