美文网首页Android 软件架构与软件架构
Android Groovy 脚本过渡为Kts脚本(3)

Android Groovy 脚本过渡为Kts脚本(3)

作者: zcwfeng | 来源:发表于2022-10-20 18:07 被阅读0次

    引入koin,进行模块划分

    在Application Module创建请求模块

    • AuthenticationInterceptor 创建授权guolv
    • UserAgentInterceptor User-Agent的设置
    • HttpLoggingInterceptor 关于HttpLoggingInterceptor设置
    • OkHttpClient & Retrofit请求设置

    先看下appModule

    默认情况下,Kotlin序列化将序列化JSON对象中存在的所有键,并抛出如果Kotlin类中不存在给定的键,则会发生异常。此标志允许忽略JSON字段

    val json = kotlinx.serialization.json.Json {
    ignoreUnknownKeys = true
    }

    相关文章

      网友评论

        本文标题:Android Groovy 脚本过渡为Kts脚本(3)

        本文链接:https://www.haomeiwen.com/subject/tviuzrtx.html