androidretrofitmoshiandroid-r8

Android Moshi Json Converter Causes kotlin.reflect.jvm.internal.KotlinReflectionInternalError


I am using Moshi as Json Converter with Retrofit in Android.

When I set minifyEnabled to true, For some API calls it works, but for others it throws this Error:

This callable does not support a default call: public constructor ErrorResponse.

Note that I am using a custom NetworkResponseAdapter and NetworkResponseCall. The exception is thrown on this line in the NetworkResponseCall when I try to convert the Json response to the ErrorResponse Data class: errorConverter.convert(error).


Solution

  • Update!! The Solution:

    It turned out I need to add the CodeGen Kapt or KSP dependency com.squareup.moshi:moshi-kotlin-codegen:1.15.0 in addition to @JsonClass(generateAdapter = true) for the Classes that use Moshi.

    Details here