https://kotlinlang.org logo
t

toxara

11/22/2018, 12:38 PM
Is there any way to make android extensions work with multiple flavor dimensions? Let's say you have two flavor dimensions:
Copy code
flavorDimensions("app", "env")
register("free") { dimension = "app" }
register("paid") { dimension = "app" }
register("dev") { dimension = "env" }
register("prod") { dimension = "env" }
And let's say you have some layouts specific to
free
and
paid
flavors, contained in
src/free/res/layout
and
src/paid/res/layout
, respectively. If I attempt to import synthetic accessors from those layouts, even though everything seems to work fine in the IDE, once I try to compile, the
kotlinx.android.synthetic.free.some_layout
package cannot be resolved. However, if I attempt to import accessors from a combined flavor (e.g.
freeDev
), it works fine.
Copy code
import kotlinx.android.synthetic.free.some_layout.* // doesn't work
import kotlinx.android.synthetic.freeDev.some_other_layout.* // works
With a single flavor dimension, everything works fine. Also, I do have the Android extensions experimental mode enabled.