We have a project structure of the form
src
src_flavor1
src_flavor2
res
res_flavor1
res_flavor2
The core logic and resources are placed in src and res folder resp. The flavoured folders only contains few files which separate the two flavors.
Im trying to define this project structure withing the build.gradle file but havnt found any success. Also Im trying to use the prductFlavor tags to create simultaneous builds of the two flavors but no success. Doing all this within the Android Studio latest build
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Assuming you have define your flavors like this:
productFlavors {
flavor1 {
...
}
flavor2 {
...
}
}
You can modify the sourceSets of each flavor
android.sourceSets.flavor1 {
java.srcDirs = ['src_flavor1']
resources.srcDir = ['res_flavor1']
}
android.sourceSets.flavor2 {
java.srcDirs = ['src_flavor2']
resources.srcDir = ['res_flavor2']
}
I hope this help... (don't hesitate to add more details about your problems since it will help us to help you)
Last remark: according my experience, Android-Studio is not very stable yet and not full-featured yet regarding gradle<-->IDE sync. So I strongly suggest you to always test your gradle scripts from the command line.