Error: No Retrofit Annotation Found. (parameter #2)
I have this Interface: public interface InterfazAguaHttp { @FormUrlEncoded @POST('/') Call saveContador(@Field('contador') Long contador, Callback call
Solution 1:
change your interface method to this
publicinterfaceInterfazAguaHttp {
@FormUrlEncoded@POST("/")
Call<String> saveContador(@Field("contador") Long contador);
}
and the rest of the code like this
Retrofit builder = newRetrofit.Builder()
.baseUrl(ValoresGlobales.urlServlet)
.addConverterFactory(GsonConverterFactory.create())
.build();
InterfazAguaHttp interfaz = builder.create(InterfazAguaHttp.class);
Call<String> respuesta = interfaz.saveContador(93847597L);
respuesta.enqueue(newCallback<String>() {
@OverridepublicvoidonResponse(Response<String> response, Retrofit retrofit) {
//Some logging
}
@OverridepublicvoidonFailure(Throwable t) {
//Some logging
}
});
Link for reference
Post a Comment for "Error: No Retrofit Annotation Found. (parameter #2)"