Updated to gradle 1.12, gradle plugin for android studio 0.10.
My project has the following structure:
3rdparty
- Graphics
- Iconsets
- IconsetBase (android-library)
- Iconset1 (android-library)
- Iconset2 (android-library)
- Iconsets
- Graphics
MainProject
- src
- main (main project)
- flavor1
- flavor2
- ...
- src
How to get the res folder contents of IconsetBase + Iconset1 to be merged into flavor1 and IconsetBase + Iconset2 into flavor2?
Before upgrading to new gradle this worked as the libraries (IconsetBase, Iconset1 and Iconset2) had the same package name as main
Here is my build.gradle of the main project:
buildscript {
repositories {
mavenCentral()
}
dependencies {
repositories {
mavenCentral()
}
classpath 'com.android.tools.build:gradle:0.10.0'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
useOldManifestMerger false
compileSdkVersion 19
buildToolsVersion "19.0.3"
lintOptions {
...
}
sourceSets {
main.java.srcDirs = ['src/main/java']
main.resources.srcDirs = ['src/main/res']
}
signingConfigs {
...
}
buildTypes {
...
}
// Common dependencies
dependencies {
compile project(':3rdparty:Graphics:Iconsets:IconsetBase')
}
defaultConfig {
...
}
productFlavors {
flavor1 { packageName "..."}
flavor2 { packageName "..."}
}
android.sourceSets.flavor1 {
dependencies { compile project(':3rdparty:Graphics:Iconsets:Iconset1') }
res { srcDir 'flavor1' }
resources { srcDir 'flavor1' }
}
android.sourceSets.flavor2 {
dependencies { compile project(':3rdparty:Graphics:Iconsets:Iconset2') }
res { srcDir 'flavor2' }
resources { srcDir 'flavor2' }
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.google.android.gms:play-services:4.3.23'
}
=EDIT=
Further explanation:
What I seek is to merge resources from another location dynamically.
Background: flavor1 has base icon set with images icon1 and icon2, flavor2 has base iconset and icon1 and icon2 also, but the icons are different per icon set. Otherwise I would have to have icon1, icon2 etc. per flavor many times, and on updates /changes of those icons It must be done for every flavor existing (I have more than 20)
Could this be achieved with some custom task without libraries?