使用Retrofit GET请求时出现NoSuchMethodError错误

时间:2018-01-03 12:58:29

标签: java rest retrofit retrofit2

我应该简单地将 get -request发送到端点并检索数据,并且已成功使用此代码的 post -request版本。但是,它似乎不适用于GET。我有一个像这样的简单模型

coreware

我的资料库

const parse = code => corewar.parser.parse(code);

let result = yield call(parse, action.redcode)

最后这是我尝试运行的地方

public class Brand {
private String id;
private String name;

public Brand(String id, String name) {
    this.id = id;
    this.name = name;
}}

它返回此错误

  

线程“main”中的异常java.lang.NoSuchMethodError:okio.BufferedSource.rangeEquals(JLokio / ByteString;)Z           在okhttp3.internal.Util.bomAwareCharset(Util.java:431)           在okhttp3.ResponseBody $ BomAwareReader.read(ResponseBody.java:249)           在com.google.gson.stream.JsonReader.fillBuffer(JsonReader.java:1295)           在com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1333)           在com.google.gson.stream.JsonReader.doPeek(JsonReader.java:549)           在com.google.gson.stream.JsonReader.peek(JsonReader.java:425)           在com.google.gson.internal.bind.CollectionTypeAdapterFactory $ Adapter.read(CollectionTypeAdapterFactory.java:74)           在com.google.gson.internal.bind.CollectionTypeAdapterFactory $ Adapter.read(CollectionTypeAdapterFactory.java:61)           at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:37)           at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:25)           at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:119)           at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:218)           at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)           在com.retrofitexample.demo.login.BrandRepoImp.getBrandList(BrandRepoImp.java:27)           在com.retrofitexample.demo.login.BrandRepoImp.main(BrandRepoImp.java:17)

     

使用退出代码1完成处理

0 个答案:

没有答案