I’m struggling to get `moshi-kotlin` working prope...
# squarelibraries
r
I’m struggling to get
moshi-kotlin
working properly. I finally got it Proguarding correctly (I think), but now I’m getting reflection crashes on my models. I’m able to work around it by providing defaults for all the constructor parameters. Is this just a requirement of using
moshi-kotlin
? The stack trace for the crash I’m experiencing:
Copy code
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: This callable does not support a default call: public constructor Session(@com.squareup.moshi.Json token: kotlin.String?, vehicle: com.company.driver.entities.Vehicle?, driver: com.company.driver.entities.Driver, @com.squareup.moshi.Json latestDvir: com.company.driver.entities.Dvir?, preferences: kotlin.collections.List<kotlin.string> = ..., @com.squareup.moshi.Json lmKey: kotlin.String?) defined in com.company.driver.entities.Session[DeserializedClassConstructorDescriptor@f1c45f0]
at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod(KCallableImpl.kt:153)
at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:110)
at com.squareup.moshi.kotlin.reflect.KotlinJsonAdapter.fromJson(KotlinJsonAdapter.kt:104)
at com.squareup.moshi.JsonAdapter$2.fromJson(JsonAdapter.java:137)
at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:45)
at retrofit2.converter.moshi.MoshiResponseBodyConverter.convert(MoshiResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:223)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:121)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)