Giter VIP home page Giter VIP logo

Comments (8)

Tlaster avatar Tlaster commented on May 29, 2024

Hi, PreCompose is targeting jvm 11, you can upgrade to jvm 11 if you're targeting jvm 1.8.

from precompose.

mahramane avatar mahramane commented on May 29, 2024

this is common gradle code
how can i upgrade jvm?

plugins {
    kotlin("multiplatform")
    id("org.jetbrains.compose")
    id("com.android.library")
}

group = "com.ainoapp.aino"
version = "1.0-SNAPSHOT"

kotlin {
    android()
    jvm("desktop") {
        jvmToolchain(11)
    }

 
    sourceSets {
        val commonMain by getting {
            dependencies {
                api(compose.runtime)
                api(compose.foundation)
                api(compose.material)
                api(compose.material3)
                api(compose.ui)
                //api(compose.animation)


                api("moe.tlaster:precompose:1.4.1")
                api("moe.tlaster:precompose-viewmodel:1.4.1")

                //val ktorVersion = "2.3.0"
                //implementation ("io.ktor:ktor-client-okhttp:$ktorVersion")
                //implementation ("io.ktor:ktor-client-content-negotiation:$ktorVersion")
                //implementation ("io.ktor:ktor-serialization-gson:$ktorVersion")
                //implementation ("io.ktor:ktor-client-logging:$ktorVersion")
                //implementation "ch.qos.logback:logback-classic:1.4.4"
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }

        val androidMain by getting {
            dependencies {
                api("androidx.appcompat:appcompat:1.6.1")
                api("androidx.core:core-ktx:1.10.0")


            }
        }
        val androidInstrumentedTest by getting {
            dependencies {
                implementation("junit:junit:4.13.2")
            }
        }
        val desktopMain by getting {
            dependencies {
                api(compose.preview)

            }
        }
        val desktopTest by getting

    }
}

android {
    compileSdk = 33
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    sourceSets["main"].res.srcDirs("src/commonMain/resources", "src/androidMain/resources")
    defaultConfig {
        minSdk = 24
        targetSdk = 33
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
}

from precompose.

Tlaster avatar Tlaster commented on May 29, 2024

Like this, by default kotlin is targeting jvm 1.8

from precompose.

mahramane avatar mahramane commented on May 29, 2024

I copy this code and paste to allprojects tag but it still didn't work :'(

    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
        kotlinOptions {
            jvmTarget = "11"
            // allWarningsAsErrors = true
            freeCompilerArgs = listOf(
                "-opt-in=kotlin.RequiresOptIn",
            )
        }
    }

from precompose.

mahramane avatar mahramane commented on May 29, 2024

https://github.com/mahramane/demo2
this is a sample project

from precompose.

Tlaster avatar Tlaster commented on May 29, 2024

Are you using jdk 11+ as your development environment? When targeting jvm 11 it requires jdk 11+ as development environment.
And I found some setup is not done yet in sample project and might cause crash, like PreCompose require using moe.tlaster.precompose.PreComposeWindow for desktop(jvm) and moe.tlaster.precompose.lifecycle.PreComposeActivity for Android, for more setup guide: here

from precompose.

mahramane avatar mahramane commented on May 29, 2024

Yes i use JDK11.
I know about PreComposeWindow I just create a sample project for you to show the path error before run project, do you download that?

Sorry for taking up your time, your library is great ♥

from precompose.

Tlaster avatar Tlaster commented on May 29, 2024

Yes, I do clone the project, and it works ok on my machine, can you confirm that java --version shows jdk11? or if you're using intellij/Android studio, make sure you're using jdk11 in project structure.

from precompose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.