Hey everybody, I am trying to add Jetpack Compose ...
# multiplatform
j
Hey everybody, I am trying to add Jetpack Compose to my KMM project and specifically the Android app, however it is not cooperating. I get this error:
java.lang.IncompatibleClassChangeError: Found class org.jetbrains.kotlin.ir.declarations.IrModuleFragment, but interface was expected
. I think it has something to do with incompatible versions of Kotlin or some dependency, so I am trying to follow the example given by the KMM sample docs. Does anyone know which direction to look for a fix?
n
Are you using
kotlinVersion 1.4.20
with the latest
1.0.0-alpha08
compose compiler version?
Copy code
composeOptions {
    kotlinCompilerVersion = "1.4.20"
    kotlinCompilerExtensionVersion = "1.0.0-alpha08"
}
j
Yes!
j
@Joost Van Wynen fwiw I have small KMM project that also uses Jetpack Compose (alpha08) if you want to compare setup https://github.com/joreilly/PeopleInSpace
j
@John O'Reilly Yes I found that, that is the sample I have been using as a reference so thanks for that! For some reason your version works perfectly and mine doesn't and I cant find any real differences in the gradle files. Anything special you had to keep in mind using Compose with KMM in comparison to a normal Kotlin Android project?
j
None that I can think of off the top of my head.
It does seem to point all right so some mixture of kotlin language dependencies
j
Ok great! Thanks for the answers and for the great and clear sample. With all the extra gradle files and configuration it is easy to miss something so I will probably restart and get that organised and sorted.
j
do you still have
kotlin("android.extensions")
by any chance?
hmm, I actually still have that as well....had thought for some reason I had had to remove it as part of moving to 1.4.20
j
Hmm this is really weird but removing
kotlin("android.extensions")
does fix my problem. My project now builds without a problem. Thanks!!
j
that's great.....will also remove it from PeopleInSpace shortly as it isn't needed anyway