Stylianos Gakis
11/28/2025, 11:26 AMjvmAndAndroid which calls functions from kotlinx.datetime which lives inside the jvm target of that library. Particularly I am trying to use import kotlinx.datetime.toJavaLocalDate.
When I copy-paste the exact same code inside androidMain and jvmMain I can call toJavaLocalDate without issues.
If I try to call toJavaLocalDate inside jvmAndAndroid it is unable to resolve it at all.
Is there a way for me to make this work, or is this a limitation due to the android and the jvm targets kinda being both jvm but not exactly?hfhbd
11/28/2025, 11:41 AMStylianos Gakis
11/28/2025, 12:15 PMimplementation(...kotlinx.datetime) in the jvmAndAndroid source set too if that would workOliver.O
11/28/2025, 12:18 PMAlbert Chang
11/28/2025, 12:38 PMKotlin doesn't currently support sharing a source set for these combinations:
• JVM + Android targetsSo the code in
jvmAndAndroidMain can only access what is accessible in commonMain.
If it's only one API, you can just use expect/actual.
If you want to access all JVM APIs, I think you need to create a JVM module and make androidMain and jvmMain depend on that module.Stylianos Gakis
11/28/2025, 12:40 PM"create a JVM module and make..."
That would mean a separate Gradle project, correct?
Albert Chang
11/28/2025, 4:26 PM