title: Unresolved reference for Java file in a different flavor when referencing from kotlin
body: <h2>Problem:</h2>
  
  <p>This question has likely been answered implicitly from all the other similar questions but I can't seem to get it to work.</p>
  
  <ul>
  <li><p>If I reference a particular java file in another flavor (different source set) from a java file in the main source set it works.</p></li>
  <li><p>If I try to reference that same file from a Kotlin file in the main source set it complains that it can't see it ("Unresolved reference").</p></li>
  <li><p>If I move the same file to the main source set it works (so it's not the file itself).</p></li>
  <li><p>If I convert the Java file to Kotlin it works (and this is my current solution) but I'd like to know why it doesn't work since it's not always so easy to convert and it should work without converting.</p></li>
  </ul>
  
  <p>Based on my Googling it seems it's related to the source sets in Gradle but I don't want a separate Kotlin folder alongside the Java folder so I'm not sure I need this. Also, another project where I have both Java and Kotlin doesn't have this configured and works fine.</p>
  
  <p>I'm using productFlavors with flavorDimensions and have a source set called "dimension1Dimension2" (that's where the Java file I'm trying to reference is located).</p>
  
  <p>Looking at my setup below, what am I possibly doing wrong or missing? This project is mostly Java so I'm just starting to add Kotlin to it. I can't see any differences with my other project that is mostly Kotlin and some Java.</p>
  
  <p><strong>One other thing that is weird is that it does work for one of the three flavors. There are two types of dimension1 and three types of dimension2. Just one of the dimension2 types works.</strong></p>
  
  <p>Maybe code is clearer:</p>
  
  <pre><code>flavorDimensions "product", "mode"    
  productFlavors {
          mock { // only this one works (e.g. &lt;company_name&gt;Mock is the source set)
              applicationIdSuffix = ".mock"
              dimension "mode"
          }
          dev {
              applicationIdSuffix = ".dev"
              dimension "mode"
          }
          prod {
              dimension "mode"
          }
          demo {
              applicationIdSuffix = ".demo"
              dimension "product"
              buildConfigField "String", "UPDATE_DIRECTORY", "\"/release/\""
              buildConfigField "boolean", "SHOW_STREAM_STATUS", "false"
          }
          &lt;company_name&gt; {
              applicationIdSuffix = ".&lt;company_name&gt;"
              dimension "product"
          }
      }
  </code></pre>
  
  <hr>
  
  <h2>Setup:</h2>
  
  <ul>
  <li>Kotlin version: 1.2.21</li>
  <li>Gradle version: 3.0.1</li>
  <li>Plugins:
  
  <ul>
  <li>apply plugin: 'kotlin-android'</li>
  <li>apply plugin: 'kotlin-kapt'</li>
  <li>apply plugin: 'kotlin-android-extensions'</li>
  </ul></li>
  <li>Project level dependencies:
  
  <ul>
  <li>classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"</li>
  </ul></li>
  <li>App level dependencies:
  
  <ul>
  <li>implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"</li>
  </ul></li>
  <li>Using Java 8 in project settings</li>
  </ul>