title: Execution failed for task: ':app:preDexDebug'
body: <p>I am experiencing that famous ':app:preDexDebug'-error.</p>
  
  <p>First of all: Cleaning the project or rebuilding it works without errors. 
  Under default settings I set the project bytecode version to 1.7 and under SDK Location in the project structure the JDK location seems to be correct, too.
  After a while of researching I still did not find the solution for this problem.</p>
  
  <p>The error occurs when I try to run the project under Android Studio. Like mentioned before, cleaning, rebuilding and syncing with Gradle works fine (looks like it - no errors).</p>
  
  <p>This is what the gradle console shows:</p>
  
  <pre><code>Configuration on demand is an incubating feature.
  :app:preBuild UP-TO-DATE
  :app:preDebugBuild UP-TO-DATE
  :app:compileDebugNdk UP-TO-DATE
  :app:checkDebugManifest
  :app:prepareDebugDependencies
  :app:compileDebugAidl UP-TO-DATE
  :app:compileDebugRenderscript UP-TO-DATE
  :app:generateDebugBuildConfig UP-TO-DATE
  :app:generateDebugAssets UP-TO-DATE
  :app:mergeDebugAssets UP-TO-DATE
  :app:generateDebugResValues UP-TO-DATE
  :app:generateDebugResources UP-TO-DATE
  :app:mergeDebugResources UP-TO-DATE
  :app:processDebugManifest UP-TO-DATE
  :app:processDebugResources UP-TO-DATE
  :app:generateDebugSources UP-TO-DATE
  :app:compileDebugJava UP-TO-DATE
  :app:preDexDebug
  AGPBI: {"kind":"SIMPLE","text":"UNEXPECTED TOP-LEVEL EXCEPTION:","position":{},"original":"UNEXPECTED TOP-LEVEL EXCEPTION:"}
  AGPBI: {"kind":"SIMPLE","text":"com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)","position":{},"original":"com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)","position":{},"original":"\tat com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processClass(Main.java:704)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processClass(Main.java:704)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.access$300(Main.java:83)","position":{},"original":"\tat com.android.dx.command.dexer.Main.access$300(Main.java:83)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)","position":{},"original":"\tat com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)","position":{},"original":"\tat com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)","position":{},"original":"\tat com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)","position":{},"original":"\tat com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processOne(Main.java:632)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processOne(Main.java:632)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)","position":{},"original":"\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)","position":{},"original":"\tat com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.run(Main.java:246)","position":{},"original":"\tat com.android.dx.command.dexer.Main.run(Main.java:246)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.dexer.Main.main(Main.java:215)","position":{},"original":"\tat com.android.dx.command.dexer.Main.main(Main.java:215)"}
  AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.command.Main.main(Main.java:106)","position":{},"original":"\tat com.android.dx.command.Main.main(Main.java:106)"}
  AGPBI: {"kind":"SIMPLE","text":"...while parsing impl/org/controlsfx/ImplUtils.class","position":{},"original":"...while parsing impl/org/controlsfx/ImplUtils.class"}
  AGPBI: {"kind":"SIMPLE","text":"1 error; aborting","position":{},"original":"1 error; aborting"}
  
  
   FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:preDexDebug'.
  &gt; com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_67\bin\java.exe'' finished with non-zero exit value 1
  </code></pre>
  
  <p>As you see below, I removed the "compile android. ..."-line in my build.gradle, but it still didn't work.
  So here is my gradle build file:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 21
      buildToolsVersion '22.0.1'
      compileOptions.encoding = 'windows-1251'
  
      defaultConfig {
          applicationId "de.giessen.advenco.key2operate"
          minSdkVersion 15
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_7
          targetCompatibility JavaVersion.VERSION_1_7
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
  }
  </code></pre>
  
  <p>It looks like Gradle has some problems with my JDK, but I don't know what kind of and how to fix them. I hope you guys can help.</p>
  
  <p>EDIT: I found out, that <code>version (0034.0000)</code> means, that I am using Java 8. The strange thing is, that I definitely do not use Java 8. In Android Studio I defined the JDK-path to <code>"C:\Program Files\Java\jdk1.7.0_67"</code>. This is 64-Bit Java (I am using Win 7 64-Bit btw.). Besides of that I have 32-Bit Java at <code>"C:\Program Files (x86)\Java\jdk1.7.0_75"</code>, but I am not pointing on its location from Android Studio (I need both versions on my machine). Does anyone know, why Android Studio thinks, that I have Java 8 on my machine? As you can see in my gradle build file, I set the <code>sourceCompatibility</code> and the <code>targetCompatibility</code> to <code>JavaVersion.VERSION_1_7</code>. Are there any hidden settings somewhere in Android Studio, which define the Java 8 setting? </p>