Hi, I'm updating a project to the new kotlin 1.8.0...
# serialization
e
Hi, I'm updating a project to the new kotlin 1.8.0 and got this error on some code: "Cannot generate external serializer 'UrlSerializer': class 'Url' is defined in another module" Url here is io.ktor.http
Copy code
@OptIn(ExperimentalSerializationApi::class)
@Serializer(forClass = Url::class)
object UrlSerializer : KSerializer<Url> {
    override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Url", PrimitiveKind.STRING)
    override fun deserialize(decoder: Decoder): Url = Url(decoder.decodeString())
    override fun serialize(encoder: Encoder, value: Url) =  encoder.encodeString(value.toString())
}
a
do you have multiple subprojects? Are you sure that KxS + Ktor are defined as dependencies in all relevant subprojects?
e
There are multiple sub projects (10-20). Works on 1.7.21 and the error message was not very help full in where to look. I'll did try set the dependency as a API to see if that helps but no change.
Copy code
Solved it by removing @OptIn(ExperimentalSerializationApi::class)
@Serializer(forClass = Url::class)
102 Views