2

First of all, i am new in React Native.
When i build my empty(completely new) project it gives an error;

Task :react-native-gradle-plugin:compileKotlin
'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version.

I found a solution the above problem but i couldn't find the location that they mention. 
Where are these code locations? Btw They say that;

**set java version for java;** 
java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}

**set jvmTarget;**
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    kotlinOptions {
        jvmTarget = "11"
    }
}
tester01
  • 116
  • 2
  • 10

1 Answers1

0

Can you try to do it like the following:

app/build.gradle

android {
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }
}

Reference: Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6

Obsidianlab
  • 667
  • 1
  • 4
  • 24