title: How do I set the jvm target for android studio using gradle and kotlin?
body: <p>I get the following error when trying to compile a unit test written in kotlin.</p>
  
  <p><code>Task :app:compileDebugUnitTestKotlin FAILED  ...Cannot inline bytecode built with JVM target 1.7 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option</code></p>
  
  <p>I've tried setting the source compatibility for my <code>android</code> configuration in my app <code>build.gradle</code>:</p>
  
  <pre><code>compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
  }
  </code></pre>
  
  <p>as well as configuring all kotlin compile tasks in the root <code>build.gradle</code>:</p>
  
  <pre><code>tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
      kotlinOptions {
          jvmTarget = '1.8'
      }
  }
  </code></pre>