title: How can I use a combination of Scala, Groovy, and Java code with Gradle?
body: <p>Recently I'm trying to make some Android apps with Android Studio.</p>
  
  <p>Does the built-in Gradle plugin support using a combination of Java, Groovy, and Scala code for building an Android app?</p>
  
  <p>Looking at the the <code>gradle-android</code> wiki, I've found that <code>sourceSet</code> does not work with Android Studio (get "R redefined" error).</p>
  
  <p>I'm using the default Gradle Wrapper way in Android Studio.</p>
  
  <p>How do I use a mix of Scala, Groovy, and Java code in my Android Studio project?</p>
  
  <p><img src="https://i.stack.imgur.com/mmup6.png" alt="My Project Screenshot here"></p>
  
  <p>I've tried to add some directives to <strong>build.gradle</strong> (like using <code>apply plugin</code> and  <code>sourceSets</code>), but they don't seem to work.</p>
  
  <p>I think changing some code like <strong>homeactivity.java</strong> into <strong>homeactivity.groovy</strong> might work, but I've not found the way to do this yet.</p>
  
  <p>When I uncomment the <code>sourceSets</code> block, I get this error message:</p>
  
  <pre class="lang-none prettyprint-override"><code>Gradle: A problem occurred evaluating project ':AgricolaScore'.
  &gt; Could not find method groovy() for arguments [build_3cmthdr3hv9648pq38oficf549$_run_closure3_closure6_closure8_closure10@15f565e7] on source set main.
  </code></pre>