You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kotlin序列化报错:未找到Any类的序列化器,尝试StackOverflow方案无效

Kotlin序列化报错:未找到Any类的序列化器,尝试StackOverflow方案无效

嘿,各位大佬,我最近写Kotlin代码时碰到了一个序列化相关的问题,卡了好半天没解决,想求助下!

错误信息是这样的:

Serializer for class 'Any' is not found.
Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.

我之前试过一个Stack上的解决方案,但对我的情况完全没用。

下面是报错相关的代码片段:

class UserAuthentication {

    private val supabase = createSupabaseClient(
        supabaseKey = "MySupabaseKey",
        supabaseUrl = "MySupabaseUrl"
    ) {
        install(io.github.jan.supabase.auth.Auth)
        install(Postgrest)
    }

    private lateinit var credentialManager: CredentialManager

    fun initializeCredentialManager(context: Context) {
        credentialManager = CredentialManager.create(context)

        val rawNonce = UUID.randomUUID().toString()
        val bytes = rawNonce.toByteArray()
        val messageDigest = MessageDigest.getInstance(...)
    }
}

我已经检查过序列化插件的配置,也确认了相关类都加了@Serializable注解,但还是报这个错,有没有大佬能帮我分析下问题出在哪呀?

备注:内容来源于stack exchange,提问作者Player91

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 11:13:01