title: Wrong Java Compiler When Including a Java Module as Dependency in Android Studio
body: <p>I have a java module in my Android Studio project that is a dependency of an Android module. I am having problems on build with the following exception appearing.</p>
  
  <pre><code>Error:Execution failed for task ':myApplication:preDexDebug'.
  &gt; com.android.ide.common.internal.LoggedErrorException: Failed to run command:
      /Applications/Android Studio.app/sdk/build-tools/android-4.4W/dx --dex --output ~/myapplication-app-android/dev/biketracks-app-android/bikeTracks/build/intermediates/pre-dexed/debug/coreUtilities-6ee7e0aafa5a6db72b2acb078f065e51c43124c2.jar ~/myapplication-app-android/dev/myapplication-app-android/libs/coreUtilities/build/libs/coreUtilities.jar
    Error Code:
      1
    Output:
      UNEXPECTED TOP-LEVEL EXCEPTION:
      com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
          at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
          at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
          at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
          at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
          at com.android.dx.command.dexer.Main.processClass(Main.java:665)
          at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
          at com.android.dx.command.dexer.Main.access$600(Main.java:78)
          at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
          at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
          at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
          at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
          at com.android.dx.command.dexer.Main.processOne(Main.java:596)
          at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
          at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
          at com.android.dx.command.dexer.Main.run(Main.java:230)
          at com.android.dx.command.dexer.Main.main(Main.java:199)
          at com.android.dx.command.Main.main(Main.java:103)
      ...while parsing com/corecoders/coreutilities/GPSUtils.class
      1 error; aborting
  </code></pre>
  
  <p>After some reading I can see that it is something to do with the Java compiler Android Studio is using. However I cannot see a way to change which compiler it uses.</p>
  
  <p>The Java module I am trying to include in my Android module is one I created using Android Studio by going File > New Module > Java Module so I can't see any option I could make different?</p>
  
  <p>Any ideas would be great.</p>