There is a news site: http://www.cbc.ca/cmlink/rss-topstories/ with an RSS feed. Can not fix the error.

08-15 16:44:35.574 12199-12199/com.ku4irka.rss_nfr E/AndroidRuntime: FATAL EXCEPTION: main Process: com.ku4irka.rss_nfr, PID: 12199 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ku4irka.rss_nfr/com.ku4irka.rss_nfr.view.activity.ListNewsActivity}: java.lang.IllegalArgumentException: Unable to create converter for java.util.List<com.ku4irka.rss_nfr.model.entity.Channel> for method ChannelService.getChannel at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1360) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:5698) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) Caused by: java.lang.IllegalArgumentException: Unable to create converter for java.util.List<com.ku4irka.rss_nfr.model.entity.Channel> for method ChannelService.getChannel at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:720) at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:706) at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:167) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166) at retrofit2.Retrofit$1.invoke(Retrofit.java:145) at java.lang.reflect.Proxy.invoke(Proxy.java:397) at $Proxy0.getChannel(Unknown Source) at com.ku4irka.rss_nfr.view.activity.ListNewsActivity.configRest(ListNewsActivity.java:48) at com.ku4irka.rss_nfr.view.activity.ListNewsActivity.onCreate(ListNewsActivity.java:36) at android.app.Activity.performCreate(Activity.java:5958) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) ... 10 more Caused by: java.lang.IllegalArgumentException: Could not locate ResponseBody converter for java.util.List<com.ku4irka.rss_nfr.model.entity.Channel>. Tried: * retrofit2.BuiltInConverters * retrofit2.converter.simplexml.SimpleXmlConverterFactory at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:346) at retrofit2.Retrofit.responseBodyConverter(Retrofit.java:308) at retrofit2.ServiceMethod$Builder.createResponseConverter(ServiceMethod.java:704) ... 20 more 

Code example:

 public class RestManager { private static final OkHttpClient CLIENT = new OkHttpClient(); private static Retrofit retrofit; private static ChannelService sChannelService; private static void retrofitSetup() { // Retrofit setup retrofit = new Retrofit.Builder() .baseUrl(Constans.HTTP.BASE_URL) .addConverterFactory(SimpleXmlConverterFactory.create()) .client(CLIENT) .build(); } public static ChannelService getChannelService() { if (sChannelService == null) { retrofitSetup(); // Service setup sChannelService = retrofit.create(ChannelService.class); } return sChannelService; } } public interface ChannelService { @GET("cmlink/rss-topstories/") Call<List<Channel>> getChannel(); } @Root(name = "channel") public class Channel { @Element(name = "guid") private double id; @Element(name = "title") private String title; @Element(name = "pubDate") private String pubDate; @Element(name = "author") private String author; @Element(name = "description") private String description; @Element(name = "link") private String link; public Channel() { } public double getId() { return id; } public void setId(double id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getPubDate() { return pubDate; } public void setPubDate(String pubDate) { this.pubDate = pubDate; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getLink() { return link; } public void setLink(String link) { this.link = link; } } private void configRest() { Call<List<Channel>> call = mRestManager.getChannelService().getChannel(); // Asynchronously execute HTTP request call.enqueue(new Callback<List<Channel>>() { /** * onResponse is called when any kind of response has been received. */ @Override public void onResponse(Call<List<Channel>> call, Response<List<Channel>> response) { if (response.isSuccessful()) { mNewsList = response.body(); setRecyclerView(); } else { int sc = response.code(); switch (sc) { case 400: Toast.makeText(ListNewsActivity.this, "'Error 400' Bad Request", Toast.LENGTH_SHORT).show(); break; case 404: Toast.makeText(ListNewsActivity.this, "'Error 404' Not Found", Toast.LENGTH_SHORT).show(); break; default: Toast.makeText(ListNewsActivity.this, "'Error' Generic Error", Toast.LENGTH_SHORT).show(); } } } @Override public void onFailure(Call<List<Channel>> call, Throwable t) { Toast.makeText(ListNewsActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show(); } }); } 

Please tell me what's the problem?

  • You have a Call <List <Channel >> getChannel (); but the Channel is the root element and it is only one. Try this Call <Channel> getChannel (); - rjhdby
  • Thank! I tried, it seems that this is not the problem. The service should return a List of objects .. - ku4irka

0