I want to transfer Id to retrofit 1.9, but the following error occurs enter image description here

Method code:

private void uploadVideo() { RestAdapter adapter = new RestAdapter.Builder() .setEndpoint("https://vimeo.com/api/v2/video/") .build(); API apiInterface = adapter.create(API.class); Callback<VideoUpload> v = apiInterface.uploadVideo(new Callback<VideoUpload>() { @Override public void success(VideoUpload videoUpload, Response response) { String id = videoUpload.getId(); } @Override public void failure(RetrofitError error) { } }); } 

Interface Code:

  @GET("/video/{id}") void uploadVideo(@Path("id") String id, Callback<VideoUpload> callback); 
  • one
    Doesn't bother you that the method is declared with two parameters, but do you call it with one? - post_zeew

1 answer 1

You are missing one parameter in the method call. You declared a method like

 void uploadVideo(@Path("id") String id, Callback<VideoUpload> callback); 

And trying to cause, as

 uploadVideo(new Callback<VideoUpload>()); 

Do not pass String id , but only Callback<VideoUpload> callback

  • Exactly, thank you) can you tell me why he offers to put "," or ") between the String id? - Morozov
  • @VadimMorozov, I will not tell you, because it is not clear that you have a String id,) - Vladyslav Matviienko
  • @VadimMorozov, show specifically the code that raises your question, at least the line - Vladyslav Matviienko
  • the studio suggested that I change @GET ("/ video / {id}") void uploadVideo (@Path ("id") String id, Callback <VideoUpload> callback); @GET ("/ video / {id}") callback <VideoUpload> uploadVideo (@Path ("id") String id, Callback <VideoUpload> callback); the error is gone. But I simply registered the id value, without the String Callback type <VideoUpload> v = apiInterface.uploadVideo (id, new Callback <VideoUpload> () I don’t know how much this will be true) - Morozov
  • @VadimMorozov, still incomprehensible. - Vladyslav Matviienko