Tlaster / PreCompose

Compose Multiplatform Navigation && State Management

Home Page:https://tlaster.github.io/PreCompose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jvm-target

Xiaolangs opened this issue · comments

viewModel
//tip
Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option

//code
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm")
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10"
id("org.jetbrains.compose")
}

group = "com.xiaolang"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
}

dependencies {
// Note, if you develop a library, you should use compose.desktop.common.
// compose.desktop.currentOs should be used in launcher-sourceSet
// (in a separate module for demo project and in testMain).
// With compose.desktop.common you will also lose @Preview functionality
implementation(compose.desktop.currentOs)

// Please do remember to add compose.foundation and compose.animation
api(compose.foundation)
api(compose.animation)
val preComposeVersion="1.5.4"
api("moe.tlaster:precompose:$preComposeVersion")
api("moe.tlaster:precompose-viewmodel:$preComposeVersion")


val ktorVersion="2.3.5"
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
//ktor 解析
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")

}
tasks.withType {
kotlinOptions {
jvmTarget = "11"
}
}

compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "bt"
packageVersion = "1.0.0"
}
}

}

Could you please check which JDK version you're using for your project? PreCompose requires at least JDK 11.

I have the same problem too and still i can't fix it. how can i check JDK version in project?
Also when I download and open the PreCompose project from github, I have this problem.

I have the same problem too and still i can't fix it. how can i check JDK version in project? Also when I download and open the PreCompose project from github, I have this problem.

Can you check which JDK version you're using by java --version?

I have the same problem too and still i can't fix it. how can i check JDK version in project? Also when I download and open the PreCompose project from github, I have this problem.

Can you check which JDK version you're using by java --version?

java 11.0.19 2023-04-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.19+9-LTS-224)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.19+9-LTS-224, mixed mode)

I have the same problem too and still i can't fix it. how can i check JDK version in project? Also when I download and open the PreCompose project from github, I have this problem.

Can you check which JDK version you're using by java --version?

java 11.0.19 2023-04-18 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.19+9-LTS-224) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.19+9-LTS-224, mixed mode)

Can you check your Intellij project SDK by opening Project Structure -> Project Settings -> Project?
And BTW, Android Gradle plugin requires Java 17 to run after version 8.0, you should using JDK 17 now.

Close as inactive, reopen if you still have the same issue.