Fatal exception on handling the Flickr Response - Moshi Converter issue

I was getting the following error when I switched to Moshi converter and hoping that it would be able to handle FlickrResponse through fetchPhotos method.

Process: com.bignerdranch.android.photogallery, PID: 30598
java.lang.IllegalArgumentException: Unable to create converter for class com.bignerdranch.android.photogallery.api.FlickrResponse
for method FlickrApi.fetchPhotos

Looks Seems like you need to create a Kotlin adapter first and pass it on the MoshiConverterFactory’s create method as a parameter:

init {
    // Kotlin reflection adapter
    val moshi = Moshi.Builder()

    val retrofit: Retrofit = Retrofit.Builder()
    flickrApi = retrofit.create(FlickrApi::class.java)

Hope it helps others who have ran into this!