title: Android Studio error: "Invoke-customs are only supported starting with Android O"
body: <p>Updated Android Studio to 3.4 and after that when running the project, then I get error "Error: Invoke-customs are only supported starting with Android O (--min-api 26)". </p>
  
  <p>I have updated realm from 5.8.0 to 5.9.0. 
  I have already tried adding </p>
  
  <pre><code>android {
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  </code></pre>
  
  <p>to app level build gradle.</p>
  
  <p>Only thing that I have found is when I go File > Project Structure > Modules</p>
  
  <p>Then under Source Compatibility and Target Compatibility it says: "$JavaVersion.VERSION_1_8 : 1.8 (Java 8) (Unresolved reference: JavaVersion.VERSION_1_8)" but I don't know how to fix this. </p>
  
  <p>Snippets of my app level build gradle:</p>
  
  <pre><code>android {
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      compileSdkVersion rootProject.ext.compileSdkVersion
      buildToolsVersion rootProject.ext.buildToolsVersion
  
      defaultConfig {
          multiDexEnabled true
  
      ...
  
      buildTypes {
          debug {
              minifyEnabled true
      ...
  </code></pre>