Ok i've got a mix of gradle version/multiplatform ...
# decompose
a
Ok i've got a mix of gradle version/multiplatform version/intelliJ version that is actually working, no one touch anything 😂 except after updating various things, my Android Module now thinks it doesn't have a compose runtime:
IncompatibleComposeRuntimeVersionException: The Compose Compiler requires the Compose Runtime to be on the class path, but none could be found. The compose compiler plugin you are using (version 1.3.2) expects a minimum runtime version of 1.0.0.
Anyone run into this before?
l
Are you using Jetpack Compose or compose-jb? If using compose-jb, make sure to have
compose.runtime
in commonMain.
a
ya I've got
Copy code
implementation(compose.runtime)
In my common module, also added it to my Android module, it doesnt care
and my desktop target works just fine
the only difference I can think of is in my desktop i've got the platform dependency:
Copy code
implementation(compose.desktop.currentOs)
But theres nothing like that for Android
l
The same setup (compose-jb + decompose) works for me with
Copy code
implementation(compose.runtime)
                implementation(compose.foundation)
                implementation(compose.material)
                implementation(compose.ui)
                implementation(compose.materialIconsExtended)
in commonMain
a
what does your Android module look like then?
or don't you have a separate one?
l
It looks like I kept the same thing in androidMain, but that shouldn’t affect anything. Should be good to remove it from androidMain.
a
my setup is slight different, I have 3 modules: Android -> ComposeUI -> Common
but shouldnt really matter
l
I do the same often, setting up a composeMain, commonMain, and {android,ios}Main.
Makes it easier to add/remove iOS support.
a
ya
l
I can;t share my work project, but I can tell you the setup in this project works well for android/ios. https://github.com/LandryNorris/MultiFactor/blob/main/mobileapp/build.gradle.kts
a
hhmmm ya interesting, so mine isn't just different source sets, its actually different modules: https://github.com/Wavesonics/hammer-editor/
l
Which module do you see the error in?
a
android
which includes
composeUi
l
I noticed you have
api(project(":composeUi"))
a
ya
l
I don’t think api brings in transitive dependencies. Try explicitly adding compose.runtime to the dependencies block of the android module.
I also noticed you seem to be mixing compose-jb and jetpack compose in the android module. Try replacing
Copy code
implementation("androidx.compose.ui:ui:$androidx_compose_version")
    implementation("androidx.compose.ui:ui-tooling:$androidx_compose_version")
    implementation("androidx.compose.foundation:foundation:$androidx_compose_version")
    implementation("androidx.compose.material:material:$androidx_compose_version")
    implementation("androidx.compose.material:material-icons-core:$androidx_compose_version")
    implementation("androidx.compose.material:material-icons-extended:$androidx_compose_version")
with the compose-jb equivalents.
a
ya actually the only one I need there is
activity-compose
removed them but it didn't change anything
l
What happens if you use implementation instead of API to pull in the compose module?
a
pushed the latest
Copy code
dependencies {
    implementation(project(":common"))
    implementation(project(":composeUi"))
    api(compose.runtime)
    api(compose.uiTooling)
    api(compose.preview)
    api(compose.foundation)
    api(compose.material)
    //api(compose.material3)
    api(compose.animation)
    api(compose.animationGraphics)
    api(compose.materialIconsExtended)
    implementation("androidx.activity:activity-compose:1.6.1")
}
same error
oh man, very strange, so down in my
common
module, which shouldn't even have any compose in it at all, I added
Copy code
val androidMain by getting {
    dependencies {
        api(compose.runtime) // <- added this
        api("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
        api("io.insert-koin:koin-android:$koin_version")
    }
}
And now it works....
ah i think i see the problem
l
You have
id("org.jetbrains.compose")
at the top
a
im applying the compose plugin there
yyuuuppp
artifact of some early hackery
l
Wherever you have the compose plugin, you have to have the runtime in every compatible target. That includes iOS if you’re on a high enough version of compose-jb. Just add the artifact and ignore it, or remove the plugin.
a
ya and i had even added it there explicitly for the desktop target
removing the plugin
hey it's all working again!
thanks for your time
638 Views