i have a strange problem: in my KMP project, Andro...
# multiplatform
j
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?
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
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
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...
c
heres the multipltfrom “date” library 🙂 https://github.com/Kotlin/kotlinx-datetime
j
ah. faster than google. many thanks 🙂
👍🏼 1