https://kotlinlang.org logo
#android
Title
# android
a

Alex

03/18/2019, 12:52 PM
Hey everyone, Maybe someone can help me out? I am creating a Moshi Codegen adapter like so:
Copy code
@JsonClass(generateAdapter = true)
data class NetPost(
    val id: Int,
    @RenderedText val title: String,
    @RenderedText val excerpt: String,
    @RenderedText val content: String,
    val images: NetPostImages,
    @UtcDateTime @Json(name = "date_gmt") val date: ZonedDateTime,
    @UtcDateTime @Json(name = "modified_gmt") val modified: ZonedDateTime
)
Setting up my moshi instance like so
Copy code
Moshi.Builder()
    .add(RenderedTextAdapter())
    .add(UtcDateTimeAdapter())
    .build()
And am using all of this inside Retrofit When accessing the api, i get the following error:
Copy code
java.lang.IllegalArgumentException: Unable to create converter for java.util.List<(...).NetPost>
Seems like I missed something with my setup? The
NetPostJsonAdapter
class is generated correctly, but it does not seem to work inside of a List.. ?
Upon further inspection the adapter is not added to the
Moshi.adapterCache
, even though another generated adapter is
e

eric

03/18/2019, 5:02 PM
post a few more stacks from the stack trace. this error is normally from platform type usage or some other error when creating the adapter.