java.lang.IllegalArgumentException: No JsonAdapter for retrofit2.Call<xxxxx.data.adapter.ActivationResponse> (with no annotations)
Message: Unable to create converter for retrofit2.Call<xxxxx.data.adapter.ActivationResponse>
for method ActivationService.postActivationPayload
I am getting this error when trying to use Moshi alongside Retrofit for handling a request
package xxxx.data.adapter
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class ActivationResponse(
var status: String,
var statusCode: String?,
var description: String?
)
interface ActivationService {
@POST("/") // substitute real path
suspend fun postActivationPayload(@Body activationPayloadPost: ActivationPayloadPost) : Call<ActivationResponse>
}
Here is the activation service im supplying into Retrofit
@JsonClass(generateAdapter = true)
data class ActivationPayloadPost(
var id: String,
var status: String?
)
Have I just completely missed a step with working with Moshi and Retrofit? I thought it was supposed to be able to read simple types on its own.
Here is the call for retro
val BASE_URL = "xxxxx"
val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(MoshiConverterFactory.create(moshi))
.build()
val activationService = retrofit.create(ActivationService::class.java)
I have already tested that my moshi object is able to use moshi.adapter(ActivationPayloadPost::class.java) .toJSON and it IS able to render the output I need, but when running through Retro its giving me this error.