title: Gradle: How to include Java project flavor dependency resources into Android APK?
body: <p>I have some resouces-only Java projects with build.gradle(s):</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'idea'
  apply plugin: 'eclipse'
  </code></pre>
  
  <p>and directory structure:</p>
  
  <pre><code>flavor1/
    src/
      main/
        resources/
          assets/
            file1.png
  flavor2/
    src/
      main/
        resources/
          assets/
            file1.png
  </code></pre>
  
  <p>and an another project (this time Android) with build.gradle:</p>
  
  <pre><code>android {
    compileSdkVersion 19
    buildToolsVersion "19"
  
    defaultConfig {
      minSdkVersion 9
      targetSdkVersion 19
    }
  
    productFlavors {
      flavor1 {
        packageName "com.mydomain.flavor1"
      }
  
      flavor2 {
        packageName "com.mydomain.flavor2"
      }
    }
  
    sourceSets {
      main {
        manifest.srcFile 'AndroidManifest.xml'
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
        java.srcDirs = ['src/main/java']
      }
      flavor1 {
        res.srcDirs = ['res-flavor1']
        assets.srcDirs = ['assets-flavor1']
      }
      flavor2 {
        res.srcDirs = ['res-flavor1']
        assets.srcDirs = ['assets-flavor2']
      }
    }
  }
  
  dependencies {
    flavor1Compile project(':flavor1')
    flavor2Compile project(':flavor2')
  }
  </code></pre>
  
  <p>with directory structure:</p>
  
  <pre><code>android_project/
    assets/
    assets-flavor1/
    assets-flavor2/
    res/
    res-flavor1/
    res-flavor2/
    src/
      main/
        java/
          com/
            ...
  </code></pre>
  
  <p>The problem is that resources from plain Java projects :flavor1 and :flavor2 are not included into resulting APK. If I include them as global dependencies:</p>
  
  <pre><code>dependencies {
    compile project(:flavor1)
  }
  </code></pre>
  
  <p>they are included in the APK fine.</p>
  
  <p>The reason of those plain Java projects is that they are resources both for Android project flavors and other projects (iOS, HTML, Java, that are not described in the question) so I can't include them directly in Android project assets.</p>
  
  <p>Can you please help me?</p>