I am trying to swap some resources in the res/raw
folder and the jniLibs/armeabi
folder based on whether its a release buildType
or a
To use flavors to vary source sets,
productFlavors{
phone{
}
tablet{
}
}
Now structure your code like,
src
main
phone
tablet
The code in main
is common between both flavors, but the code in phone
or tablet
is only included when the respective flavor is built. That's it, you don't need to do anything else.
The structure under phone
and tablet
is the same as under main
(res
, java
, etc). You can also have a custom AndroidManifest.xml
under the flavor directory. Gradle attempts to merge the flavor's AndroidManifest.xml
with the one in main. In some cases you have to provide rules for how to merge.