title: Retrofit 2: error in my GET request
body: <p>I'm developing an Android app that shows movie posters for top rated movies. I want to build this by using Retrofit 2. However, I keep getting the error 'Service methods cannot return void'. Here's the stack trace:</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.hfad.popularmovies, PID: 17921
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hfad.popularmovies/com.hfad.popularmovies.MainActivity}: java.lang.IllegalArgumentException: Service methods cannot return void.
  for method MoviesAPI.getFeedPopular
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
  at android.app.ActivityThread.-wrap11(ActivityThread.java)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
  at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:5417)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  Caused by: java.lang.IllegalArgumentException: Service methods cannot return void.
  </code></pre>
  
  <p>I have created a POJO containing the fields I need &amp; the necessary interface containing the get request => </p>
  
  <pre><code>public interface MoviesAPI {
      @GET("/movie/top_rated?api_key=XXXXXXX")
      void getFeedTopRated(Callback &lt;List&lt;Movie&gt;&gt; response);
  
      @GET("/movie/popular?api_key=XXXXXXX")
      void getFeedPopular(Callback&lt;List&lt;Movie&gt;&gt; response);
  }
  </code></pre>
  
  <p>Here's the fragment that should display the posters through a RecyclerView:</p>
  
  <pre><code>public class TopRatedFragment extends Fragment {
      private static final String ENDPOINT = "http://api.themoviedb.org/3/";
      private PosterAdapter adapter;
      private List&lt;Movie&gt; movieList;
  
      public TopRatedFragment() {
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_top_rated, container, false);
          adapter = new PosterAdapter(getActivity());
          recyclerView.setAdapter(adapter);
          GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 2);
          recyclerView.setLayoutManager(layoutManager);
          getTopRatedMovies();
  
          return recyclerView;
      }
  
      private void getTopRatedMovies() {
          Retrofit retrofit = new Retrofit.Builder()
                             .baseUrl(ENDPOINT)
                             .build();
          MoviesAPI api = retrofit.create(MoviesAPI.class);
          api.getFeedTopRated(new Callback&lt;List&lt;Movie&gt;&gt;() {
          @Override
          public void onResponse(Call&lt;List&lt;Movie&gt;&gt; call, Response&lt;List&lt;Movie&gt;&gt; response) {
              movieList = response.body();
              for (Movie movie : movieList) {
                  movie.getPoster_path(); //I get the same error when I use 
              }
          }
  
          @Override
          public void onFailure(Call&lt;List&lt;Movie&gt;&gt; call, Throwable t) {
          }
      });
    }
  }
  </code></pre>
  
  <p>Please, let me know if I should provide more code or background information.</p>