Hi all, I am working on a KMM library project for ...
# multiplatform
b
Hi all, I am working on a KMM library project for android and ios, I have a separate module that contains data classes that are using
Moshi
annotations. I am having compile errors (
Unresolved reference
) when using said data classes inside my KMM library. I've read articles that says it doesn't support other serializing dependencies other than the
kotlinx.serialization
. Is there a way to convert moshi data class into a kotlinx.serialized class inside a KMM project?
m
there is no automated migration you have to do your own changes 🙂 All I can do for you providing my PR for relavant changes: https://github.com/CurrencyConverterCalculator/CCC/pull/65 You can specifically check for
CurrencyResponse
class • the removed one is the one with Moshi • the added one is the one with
kotlinx.serialization
👌 1
b
@Mustafa Ozhan Hi, thank you for the quick response. I appreciate it. I guess I really have to find a way to change this manually to kotlinx.serialized. However, I have no control of the code of the moshi data classes since it is published via codeartifact. Is there any specific reason why is it not working? or are the KMM team working on this? I can't see any documentations mentioning about this issue.
m
It is because Moshi doesn’t have support for KMP, better to say in your case they do not support kotlin native. So you need to choose your libraries respectively, not all kotlin platforms (jvm,native,js)
✅ 1