我想从一个带有 Retrofit
的 URL 中获取 RSS 代码,如果我在 get 注释中静态地输入 URL,那么一切都没问题,但是如果使用动态 URL,我会得到一个错误。
我的接口服务:
public interface AllNewsService {
@GET("/fa/rss/{url}")
void getRss( @Path("url") String nGroup , Callback<AllNewsRss> callback);}
调用 getRss 方法:
DataGetter dg = new DataGetter();
dg.get().getRss("allnews" ,new Callback<AllNewsRss>() {
@Override
public void success(AllNewsRss allNewsRss, Response response) {
Log.d(TAG,"success");
}
@Override
public void failure(RetrofitError error) {
Log.d("*********",error.toString());
}
我得到以下错误:
retrofit.RetrofitError: AllNewsService.getRss: No Retrofit annotation found. (parameter #1)
注意: 我给 proguard.cfg
添加了下面一行,但是没有用
-keep class retrofit.** { *; }