title: Gradle: Both Java and Android Subprojects on Same Project
body: <p>TL;DR: IS the only way to develop both pure Java and Android applications, is on completely different Gradle projects?</p>
  
  <p>I am developing a project which includes an Android application and a Java backend (along with some other common APIs).<br>
  As an IDE I am using IntelliJ Idea.<br>
  I would like to have a single Gradle project (which will be opened on a single Idea instance), that contains all the applications as subprojects.</p>
  
  <p>My problem is that in order to allow the Android plugin, I need to set it in the <code>buildScript</code> section in <code>build.gradle</code> file:</p>
  
  <pre><code>dependencies {
      classpath 'com.android.tools.build:gradle:2.2.3'
  }
  </code></pre>
  
  <p>This forces the android plugin in the entire Gradle build process, and causes errors on the pure Java subprojects (they are automatically set to be built with the Android SDK instead of the Java SDK).</p>
  
  <p>A workaround I have thought of is creating two separate projects (one for Android and one for Java), export the common JARs into a local Maven repository and import it from there into the Android project.</p>
  
  <p>Is there a better solution that will allow me to have all the code base in the same place?</p>