zap*_*tec 18 inheritance android retrofit
我正在使用Retrofit 2 beta 2的下一个问题:
java.lang.IllegalArgumentException: API interfaces must not extend other interfaces.
Run Code Online (Sandbox Code Playgroud)
这是因为我有一个用于Retrofit API的接口,如下所示:
public interface RetrofitBaseAPI {
@POST
Call<LoginResp> login(@Url String url, @Body LoginReq loginReq);
@POST
Call<String> logout(@Url String url, @Header("Cookie") String sid);
}
Run Code Online (Sandbox Code Playgroud)
例如,其中一个就是这个:
public interface RetrofitWiserLinkAPI extends RetrofitBaseAPI {
@GET("/rs/DeviceIdentification")
Call<DeviceId> getDeviceIdentification(@Header("Cookie") String sid);
}
Run Code Online (Sandbox Code Playgroud)
然后,我有三个其他接口,其中三个从这个RetrofitBaseAPI接口扩展.
当我尝试使用给定的接口调用retrofit.create(Class类)时,我总是收到此错误.
据我所知,唯一的解决方案是创建三个独立的接口.这是真的吗?有谁知道另一个解决方案?
我觉得有点奇怪,我们需要重复代码,但是,也许有一个我不理解的原因.....
提前致谢!
谢谢,
编辑:使用最终的Retrofit 2发布版本的相同问题.我想这是Retrofit的限制....