Hi :wave: , first post here :slightly_smiling_face...
# serialization
p
Hi 👋 , first post here 🙂 I have a problem adding
serialization-protobuf
to my android project. This is what I am doing. in project level build.gradle:
Copy code
buildscipt {
dependencies {
        classpath "org.jetbrains.kotlin:kotlin-serialization:${versions.kotlin}"
}
}

apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
in app-level build.gradle:
Copy code
plugins {
    id 'kotlinx-serialization'
}
dependencies {
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.4.20"
}
I got following error:
Copy code
Could not find org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.4.20
I believe I wrongly configured the plugins, but I do not found any guide for android. All of them are for multiplatform 🙂 . Can anyone point me where the issue is?
r
Your dependency version is wrong, it should be
1.0.1
. The plugin uses Kotlin's version, but the runtime has it's own (see https://github.com/Kotlin/kotlinx.serialization)
n
the plugin block should be different though
Copy code
plugins {
    id 'org.jetbrains.kotlin.multiplatform' version '1.4.20'
    id 'org.jetbrains.kotlin.plugin.serialization' version '1.4.20'
}
https://github.com/Kotlin/kotlinx.serialization#gradle
and in app level it should be
id 'org.jetbrains.kotlin.plugin.serialization'
without a version
p
thanks. I wrongly used the library, not the plugin. The lib version is 1.0.1 as @rnett pointed