JakeWharton/retrofit2-kotlinx-serialization-converter

Json is not resolved for 0.8.0 version

mironoff2007 opened this issue · 1 comments

Hello

implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0")
val contentType = "application/json".toMediaType()
val retrofit = Retrofit.Builder()
.baseUrl("https://example.com/")
.addConverterFactory(Json.asConverterFactory(contentType))
.build()

->Json is not resolved.

For
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.5.0")
It is option to import Json
->"requires at least 1.0-M1-SNAPSHOT. Please update your kotlinx.serialization runtime dependency." occurs


'com.android.tools.build:gradle:7.1.0'
gradle-7.3.3
kotlin_version = '1.6.10'

kotlinx-serialization moved JSON support out of the core and into its own artifact. You need to add a dependency on kotlinx-serialization-json. In general, it's a best practice to have a dependency on kotlinx-serialization-core and also the format dependency to ensure their versions are up-to-date and kept in sync. This library depends on the lowest possible version to ensure maximum compatibility.