英文:
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
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 = '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
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版本:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论