compileDebugJavaWithJava' task (current target is 11) and compileDebugKotlin task (current target is 17) jvm target compatibility should be same Java

huangapple go评论112阅读模式
英文:

compileDebugJavaWithJava' task (current target is 11) and compileDebugKotlin task (current target is 17) jvm target compatibility should be same Java

问题

I just updated my react-native project to 0.72 and i am facing issue with my TurboModule. I did add

compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

   kotlinOptions {
        jvmTarget = '17'
    }

in my project's build.gradle as well as in turbomodule's build.gradle file.

I also changed build.gradle.kts

java {
  sourceCompatibility = JavaVersion.VERSION_17
  targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType<KotlinCompile> {
  kotlinOptions {
    jvmTarget = JavaVersion.VERSION_17.majorVersion
    apiVersion = "1.5"
    languageVersion = "1.5"
  }
}

Updated the same in android studio as well

compileDebugJavaWithJava' task (current target is 11) and compileDebugKotlin task (current target is 17) jvm target compatibility should be same Java

Entire source code here

英文:

I just updated my react-native project to 0.72 and i am facing issue with my TurboModule. I did add

compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

   kotlinOptions {
        jvmTarget = &#39;17&#39;
    }

in my project's build.gradle as well as in turbomodule's build.gradle file.

I also changed build.gradle.kts

java {
  sourceCompatibility = JavaVersion.VERSION_17
  targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType&lt;KotlinCompile&gt; {
  kotlinOptions {
    jvmTarget = JavaVersion.VERSION_17.majorVersion
    apiVersion = &quot;1.5&quot;
    languageVersion = &quot;1.5&quot;
  }
}

Updated the same in android studio as well

compileDebugJavaWithJava' task (current target is 11) and compileDebugKotlin task (current target is 17) jvm target compatibility should be same Java

Entire source code here

答案1

得分: 1

将Java版本从17更改为11,它将正常工作。
在你的app.gradle文件中,像这样更改Java版本:

compileOptions {
    sourceCompatibility JavaVersion.VERSION_11
    targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
    jvmTarget = '11'
}

然后按照这个图片下载Java JDK 11版本:

compileDebugJavaWithJava' task (current target is 11) and compileDebugKotlin task (current target is 17) jvm target compatibility should be same Java

英文:

change java version from 17 to 11 it will work
change in your app.gradle java version like this

compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = &#39;11&#39;
    }

and download Javajdk 11 version like this compileDebugJavaWithJava' task (current target is 11) and compileDebugKotlin task (current target is 17) jvm target compatibility should be same Java

huangapple
  • 本文由 发表于 2023年6月26日 15:59:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76554669.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定