PreCompose icon indicating copy to clipboard operation
PreCompose copied to clipboard

commonMain can't find any package from PreCompose but other modules can

Open liplum opened this issue 2 years ago • 2 comments

I'm using the official compose multiplatforms template from JetBrains/compose-jb.

commonMain can't find any package from PreCompose, of course, including the classes, and Android Studio marks them red. However, when I import moe.tlaster.* in desktopMain, it works.

After researching, I read this issue and speculate it may be because of how you publish this library not an issue of compose multiplatform.

Furthermore, your sample project is using api(project(":precompose")), yes I can build and run it, so it doesn't meet this issue.

at common/build.gradle.kts

kotlin {
    android()
    jvm("desktop")

    sourceSets {
        named("commonMain") {
            dependencies {
                api(compose.runtime)
                api(compose.foundation)
                api(compose.material)
                // Needed only for preview.
                implementation(compose.preview)
                api("moe.tlaster:precompose:1.1.5")
            }
        }
        named("androidMain") {
            dependencies {
                api("androidx.appcompat:appcompat:1.4.2")
                api("androidx.core:core-ktx:1.8.0")
            }
        }
    }
}

liplum avatar Jun 16 '22 09:06 liplum

Thank you for the link you provided, I'm also facing the same issue but I'm just too busy to find out a solution. I will fix it this week.

Tlaster avatar Jun 16 '22 12:06 Tlaster

Hi, could you please try version 1.2.1? It should fix this issue.

Tlaster avatar Jun 21 '22 09:06 Tlaster

Closing as fixed

Tlaster avatar Sep 08 '22 01:09 Tlaster