The use of the Kotlinx Serialization requires specific configuration in the build project. The serialization project requires a minimum version for the Kotlin compiler and that is 1.3.20. At the time of writing, version 1.3.21 is available.
Using Gradle as the build system, we will build the gradle.build file to support a project using kotlinx.serialization. Here are the sections in the build file to add and enable the serialization compiler plugin:
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
apply plugin: 'kotlinx-serialization'
Next, you have to add the dependency for the serialization runtime library. Note that, while the plugin version is the same as the compiler one, the runtime library has a different repository and versioning...