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 的步骤?我认为它应该能够自行读取简单类型。 …
当我加载网页给我这个错误时,我只是从Visual Studio发布了它,当时它的功能非常好,现在给我一个错误。
配置错误
说明:在处理服务于此请求所需的配置文件期间发生错误。请查看下面的特定错误详细信息,并适当修改您的配置文件。
解析器错误消息:使用超出应用程序级别注册为allowDefinition ='MachineToApplication'的节是错误的。此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的。
源错误:
Run Code Online (Sandbox Code Playgroud)Line 87: ASP.NET to identify an incoming user. Line 88: --> Line 89: <authentication mode="Windows"/> Line 90: <!-- Line 91: The <customErrors> section enables configuration