Multipart request with Retrofit @PartMap Error in Kotlin (Android)

Use HashMap or MutableMap instead of Map< K, out V> for the PartMap

An alternative way works fine for me. Mentioned by alex-tpom6oh in Retrofi Kotlin Issue

I think it's happening because the Map declaration is public interface Map< K, out V> and the out word makes the value type generic. You can try to use MutableMap or HashMap instead.

@Multipart
@POST("customer")
fun updateCustomerDetail(@PartMap map: HashMap<String, RequestBody>): Call<UpdateCustomer>

Add @JvmSuppressWildcards before RequestBody

fun updateCustomerDetail(@PartMap map: Map<String, @JvmSuppressWildcards RequestBody >): Call<UpdateCustomer>