I have a question about Gradle with multiplatform ...
# multiplatform
l
I have a question about Gradle with multiplatform kotlin projects. I have a project where 99% of the code is in
common
, and then there is some glue code in
jvm
,
js
and
linux
that allows me to target these platforms. I also have a separate project that links to it in order to provide an Android UI. Now, I recently added some code to the
jvm
part of the project that doesn't compile on Android (it uses some Java 21 API's). Is there a way to separate out the non-Android code so that the Android build doesn't try to compile it?
a
yes, add an a`ndroid` target in your
build.gradle.kts
l
@andylamax thanks a lot for your reply. I still have one question: There are a lot of
actual
implementations in the
jvm
package that I want to use from the
android
one. Is there a different target I can use that is shared between
jvm
and
android
?
a
You can add an intermediate sourceSet (lets call it jvmAndAndroid), all those code can live in there and the unique ones can live inside their platform specific sourceSet
l
@andylamax I see, thanks. I'll try this.