I've got a project that uses the experimental gradle plugin, i.e. 0.2.0
. When I've got no productFlavor
, I can perfectly integrate a library module in Android Studio and everything works perfectly. But when the library has a productFlavor
, I main project doesn't find the library classes.
This fix does not appear to work with the experimental gradle plugin. Does anyone have any idea how make flavors work with the new plugin?
Library:
android.productFlavor {
create ('flavor') {
...
}
}
Project:
...
dependencies {
compile project(':mylibrary')
}
The syntax is wrong.
With the experimental plugin (0.2.1) flavors are define outside the
android
block and the right syntax isandroid.productFlavors
This might help?
From here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Referencing-a-Library
The things are a little bit more complex. I've tested on gradle experimental 0.8.0
on the library you need:
on the app you need:
hopefully, if you run full assemble you will get 2 apk's, one for each flavor . I've used "./gradlew build" from a cmd and got them. note that for your lib, you will get an AAR for each flavor too