I’m trying to update a Kotlin Multiplatform projec...
# gradle
a
I’m trying to update a Kotlin Multiplatform project to use convention plugins. I’ve also updated Gradle from v7 to v8, and thus the Android version from v7 to v8. The Kotlin docs say “Manually apply an Android Gradle plugin: com.android.application or com.android.library”, but when I do this I get an error:
Copy code
com.android.build.gradle.internal.BadPluginException: The 'java' plugin has been applied, but it is not compatible with the Android plugins.
Is there an example of how to add the Kotlin Multiplatform plugin and the Android Library plugin?
m
I think it's order dependent, do you have android first?
Copy code
plugins {
  id("com.android.library")
  id("org.jetbrains.kotlin.multiplatform")
}
e
org.jetbrains.kotlin.multiplatform
you mean? given that the question mentions multiplatform
m
Right 👍 , editing
e
order should not be dependent but what does matter is that you can't use Android and
withJava()
a
yes that’s right, sorry I should have added it
Copy code
plugins {
    id("my.conventions.kotlin-multiplatform-jvm")
    id("my.conventions.android-library")
    id("my.conventions.publishing")
}
where
my.conventions.kotlin-multiplatform-jvm
applies
kotlin("multiplatform")
and enables
jvm()
, and
my.conventions.android-library
applies
com.android.library
m
There's and example here
a
that’s the one, removing
withJava()
fixed it, thanks @ephemient