How to fix "No Retrofit annotation found." in simple GET callback?

Kristin Vernon :

I'm following a tutorial online to get information from a local API using retrofit2, but when I run my code I get:

java.lang.IllegalArgumentException: No Retrofit annotation found. (parameter #1)

I notice most answers online have this problem when POSTing but all I'm trying to do is GET all the items in the database. The API part o this works and when I go to the local IP (10.0.2.2) on the emulator it gives me what I want. I don't understand why I'm getting this problem, actually still trying to fully understand the base code. I also saw some solutions using .enqueue but I guess i don't fully understand how to use it.

@GET("/institute/Students")
    void getStudent(Callback<List<Student>> callback);
 InstituteService serv = restService.getService();
 serv.getStudent(new Callback<List<Student>>() {...}

I'm trying to get a list of students from my database but I'm stuck right here. After initiating the Callback it goes straight to the onFailure activity. Any point in the right direction appreciated.

Martin Zeitler :

These interface descriptions should return Call instead of void:

import retrofit2.Call;
import retrofit2.http.GET;
...

@GET("institute/students")
Call<ArrayList<Student>> getStudents();

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=143356&siteId=1
Recommended