https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

Joost Van Wynen

12/04/2020, 1:20 PM
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

nrobi

12/04/2020, 1:27 PM
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

Joost Van Wynen

12/04/2020, 1:30 PM
Yes!
j

John O'Reilly

12/04/2020, 1:44 PM
@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

Joost Van Wynen

12/04/2020, 1:55 PM
@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

John O'Reilly

12/04/2020, 1:56 PM
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

Joost Van Wynen

12/04/2020, 2:02 PM
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

John O'Reilly

12/04/2020, 2:02 PM
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

Joost Van Wynen

12/04/2020, 2:16 PM
Hmm this is really weird but removing
kotlin("android.extensions")
does fix my problem. My project now builds without a problem. Thanks!!
j

John O'Reilly

12/04/2020, 2:17 PM
that's great.....will also remove it from PeopleInSpace shortly as it isn't needed anyway