我正在嘗試將改造2.0.0-beta集成到我的應用程序中。無法在改造2.0.0中創建通話適配器
{
"success":true,
"categoryDetails":[
{
"topicId":550,
"categoryName":"Classshshs",
「categoryImageUrl」 : 「http://s3-apdd-southeast-1.amazonaws.com/tv-dev/member/photo/883191-medium130.jpg」,
},
{
"topicId":550661,
"categoryName":"Cricket sss",
「categoryImageUrl」 : 「http://s3-apdd-southeast-1.amazonaws.com/tv-dev/member/photo/883191-medium130.jpg」,
}
],
"totalCategoryCount":2
}
我休息適配器
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://s3-ap-southeast-1.amazonaws.com").
addConverterFactory(GsonConverterFactory.create())
.build();
service=retrofit.create(RetrofitService.class);
我的呼叫方法
Call<Object> call=service.listRs();
call.enqueue(new Callback<Object>() {
@Override
public void onResponse(Response<Object> response) {
Log.e(TAG,"sucess"+response.toString());
}
@Override
public void onFailure(Throwable t) {
}
});
Caused by: java.lang.IllegalArgumentException: Unable to create call adapter for interface retrofit.Call
for method RetrofitService.listRs
at retrofit.Utils.methodError(Utils.java:201)
at retrofit.MethodHandler.createCallAdapter(MethodHandler.java:51)
at retrofit.MethodHandler.create(MethodHandler.java:29)
at retrofit.Retrofit.loadMethodHandler(Retrofit.java:138)
at retrofit.Retrofit$1.invoke(Retrofit.java:127)
at java.lang.reflect.Proxy.invoke(Proxy.java:397)
at $Proxy1.listRs(Unknown Source)
不確定它是否爲複製粘貼問題,但是您的JSON無效:每個categoryImageUrl值後都有一個逗號。 – akodiakson
你能明確你得到什麼錯誤信息嗎?這是一個編譯錯誤? – akodiakson
@akodiakson即複製粘貼錯誤.. – Asthme