i have a strange problem: in my KMP project, Android Studio doesn't seem to like my use of any java package. e.g.,
java.io.File
(as a test) breaks because
java
is unknown. everything under
java.*
fails for the same reasons. my guess is that it's related to the KMP project setup (which came from the wizard), but that still makes no sense. has anyone else seen that?
jasondlee
01/05/2025, 8:17 PM
java.time.LocalDate
is the class i'm most immediately interested in, so I've experimented with others and they all fail. i'm lost as to why π
c
Chrimaeon
01/05/2025, 8:19 PM
in the common target you cannot use any JVM packages. itβs kotlin multiplatform for a reason. if you want to use java specfic code you need to use the
jvm
target.
j
jasondlee
01/05/2025, 8:20 PM
hrm. ok. that's what I was suspecting, but I was hoping that whatever the complier does to make my kotlin code run on, say, ios, would also be done to any necessary JVM classes. π i guess I need to cast around for a KMP-safe date library...