Tlaster / PreCompose

Compose Multiplatform Navigation && State Management
https://tlaster.github.io/PreCompose/
MIT License
869 stars 51 forks source link

jvm-target #158

Closed Xiaolangs closed 1 year ago

Xiaolangs commented 1 year ago

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" } }

}

Tlaster commented 1 year ago

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

mahramane commented 1 year ago

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.

Tlaster commented 1 year ago

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?

mahramane commented 1 year ago

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)

Tlaster commented 1 year ago

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.

Tlaster commented 1 year ago

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

LichtHong commented 1 year ago

MPP, IDE: common source set always has default JVM target

andremion commented 11 months ago

Temporary solution:

@file:Suppress("INLINE_FROM_HIGHER_PLATFORM")

https://youtrack.jetbrains.com/issue/KTIJ-18375/MPP-IDE-common-source-set-always-has-default-JVM-target#focus=Comments-27-8204064.0-0