i looking way include flavors dynamically
to so, try include subproject attributes configure main android project. here example:
app |-> src | |-> flavor | |-> build.gradle |-> build.gradle |-> settings.gradle app/settings.gradle
include ':src:flavor' app/src/flavor/build.gradle
ext { isflavor = true } app/build.gradle
... android { ... productflavors { getallprojects().each { project -> if (project.ext.has("isflavor")) { def name = project.getname() "$name" { applicationid "com.example.app.$name" } } } } } this looks amazing.. doesn't work! because android configured before gradle checks subprojects , flavor.ext.isflavor doesn't exists yet. , if use configuration injection, android spit on face wouldn't dare!
android tasks have been created i have read on stackoverflow have create attributes in rootproject , configure android in each subprojects.
but in case subprojects aren't projects flavors..
does has idea configure attribute in subprojects , uses them in rootproject ?
i search near apply from: feature right now..
p.s: here main thread other solution: gradle dynamic flavor
i used conditional , apply from: force lifecycle apply values:
if (new file(project(":app").getprojectdir().getpath() + "/flavors.gradle").exists()) { apply from: "flavors.gradle" }
Comments
Post a Comment