[SOLVED] Greetings. Something weird is going on wi...
# decompose
r
[SOLVED] Greetings. Something weird is going on with my KMP project. I understand, it is in Alpha and all the stuff. This is "compose" module (doing the way it is done in
decompose
samples. Check this out, compiler complains, however build is OK and I actually can get the instance during runtime. The build.kts for this module is:
Copy code
...
sourceSets {
    all {
      languageSettings.apply {
        optIn("kotlin.RequiresOptIn")
        optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
        optIn("org.jetbrains.compose.ExperimentalComposeLibrary")
      }
    }
    val androidMain by getting {
      dependencies {
        api("androidx.appcompat:appcompat:1.5.1")

        implementation("androidx.compose.material3:material3:1.1.0-alpha02")
        implementation("androidx.compose.material3:material3-window-size-class:1.1.0-alpha02")
      }
    }
    val commonMain by getting {
      dependencies {
        implementation(project(":shared"))

        api(compose.runtime)
        api(compose.foundation)
        @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
        api(compose.material3)

        // Decompose
        implementation("com.arkivanov.decompose:decompose:1.0.0-beta-01")
        // Value<T>.subscribeAsState()
        implementation("com.arkivanov.decompose:extensions-compose-jetbrains:1.0.0-beta-01")
      }
    }
    val jvmMain by getting {
      dependencies {
        implementation(compose.desktop.currentOs)
      }
    }
  }
...
Caches were invalidated and IDEA restarted btw :^)
The goal is to work with shared component fields via
subscribeAsState()
and use it both in
android
and
desktop
app
So it looks like
commonMain
"doesn't see"
extensions
dependency. But it should be there.
a
Which targets do you have configured in that module?
r
@Arkadii Ivanov
androidMain
,
commonMain
and
jvmMain
a
If it compiles and you have only JVM and android targets, then this is weird. This might be an IDE issue. You can try deleting the .idea folder and reopening the project. Or maybe try a different IDE.
It would be good to see a reproducer, maybe something is wrong in Gradle configuration or in the code.
r
@Arkadii Ivanov switched from Android Studio to IntelliJ, all is fine... 😬
Thanks, Arkadii. BTW, great job with Decompose, solves our pain.
a
Thanks for the feedback! Feel free to add your project to the (voluntary) Used By list - https://github.com/arkivanov/Decompose/issues/187
r
@Arkadii Ivanov will do that after MVP release, be sure! ❤️