我的 Retrofit Java class 不断返回错误行
My Retrofit Java class keeps returning an error line
我正在尝试在我的 Android 应用程序中使用 API 调用 post 使用 Retrofit 的数据。但是我的 UserService Class 一直指向我的代码行中的错误。查了又查,好像没发现问题。
package com.example.xxxxx;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public class UserService {
@POST("api/enroll_vehicle")
Call<UserResponse> saveUser(@Body UserRequest userRequest);
}
Retrofit 适用于 interface
,而不适用于 class
。将 class
更改为 interface
。
另外,如果你有一个class
,那里的方法应该有一个方法体。这可能是您看到的错误。
我正在尝试在我的 Android 应用程序中使用 API 调用 post 使用 Retrofit 的数据。但是我的 UserService Class 一直指向我的代码行中的错误。查了又查,好像没发现问题。
package com.example.xxxxx;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
public class UserService {
@POST("api/enroll_vehicle")
Call<UserResponse> saveUser(@Body UserRequest userRequest);
}
Retrofit 适用于 interface
,而不适用于 class
。将 class
更改为 interface
。
另外,如果你有一个class
,那里的方法应该有一个方法体。这可能是您看到的错误。