1 year ago
#199494
Bitwise DEVS
Moshi: When is Reflection needed?
Currently using Moshi with Retrofit but need to look back as I noticed I am not implementing it right and confused when to add kotlin-reflect
in the dependencies.
According to README
The reflection adapter requires the following additional dependency:
implementation("com.squareup.moshi:moshi-kotlin:1.13.0")
I thought the above dependency is the actual Moshi dependency but it seems it is not needed unless you are using KotlinJsonAdapterFactory
. What is KotlinJsonAdapterFactory
anyway, is it responsible for converting Kotlin classes to JSON?
Currently I have this dependencies and annotation processor.
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
// Retrofit 2 + Moshi
ksp 'com.squareup.moshi:moshi-kotlin-codegen:1.12.0'
implementation 'com.squareup.moshi:moshi-kotlin:1.12.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
If I will be using Moshi with Codegen only, can I remove the others and ended up on just these two dependency?
ksp 'com.squareup.moshi:moshi-kotlin-codegen:1.12.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
android
kotlin
moshi
reflections
kotlin-reflect
0 Answers
Your Answer