Retrofit + Moshi - 找到 NoJsonAdapter

Cod*_*nes 5 android kotlin moshi retrofit2

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
Run Code Online (Sandbox Code Playgroud)

当尝试将 Moshi 与 Retrofit 一起使用来处理请求时,我收到此错误

package xxxx.data.adapter
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class ActivationResponse(
    var status: String,
    var statusCode: String?,
    var description: String?
)
Run Code Online (Sandbox Code Playgroud)
interface ActivationService { 
@POST("/") // substitute real path
    suspend fun postActivationPayload(@Body activationPayloadPost: ActivationPayloadPost) : Call<ActivationResponse>
}
Run Code Online (Sandbox Code Playgroud)

这是我向 Retrofit 提供的激活服务

@JsonClass(generateAdapter = true)
data class ActivationPayloadPost(
    var id: String,
    var status: String?
)
Run Code Online (Sandbox Code Playgroud)

我是否完全错过了使用 Moshi 和 Retrofit 的步骤?我认为它应该能够自行读取简单类型。

这里是对复古的呼唤

        val BASE_URL = "xxxxx"
        val retrofit = Retrofit.Builder()
            .baseUrl(BASE_URL)
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .build()
        val activationService = retrofit.create(ActivationService::class.java)
Run Code Online (Sandbox Code Playgroud)

我已经测试过我的 moshi 对象能够使用 moshi.adapter(ActivationPayloadPost::class.java) .toJSON 并且它能够呈现我需要的输出,但是当通过 Retro 运行时它给了我这个错误。