Recently I switched to MoshiConverterFactory from GSONConverterFactory. Every thing s working fine except the one call. Like other API calls here also I am using @Body annotation but I am getting this error java.lang.IllegalArgumentException: Unable to create @Body converter for class
my request class :
data class DemoRequest(
val emailId: String? = null,
val demoData: List<DemoDomain?>? = null,
val userName: String? = null
)
One more thing here to mention that with GSONConverterFactory it is working fine but as I switched to MoshiConverterFactory it is throwing error.
retrofitVersion = '2.3.0'
service interface:
@POST("call/api")
fun sendToServer(@Body request: DemoRequest):retrofit2.Call<RemoteResponse>
val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.client(okHttpClient)
.addConverterFactory(MoshiConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build()
UPDATE------------- I was sending Date object in request so I need to use custom adapter and it is working fine now