0
当我调用我的inteface getRepo的方法它显示一个错误服务方法无法返回void方法Github.getRepo当我运行并检查调试它崩溃在interfac调用我让我该getRepo方法无法使用retofit 2.0 Beta在android
my mainActivity mtehod to call the api is
Github api = GitHubService.getService();
api.getRepo("basil2style", new Callback<Repository>() {
@Override
public void onResponse(Call<Repository> call, Response<Repository> response) {
}
@Override
public void onFailure(Call<Repository> call, Throwable t) {
}
});
And my model class is
package functionapps.retrofitdemo.AsyncHelper;
public class Repository {
public String name;
public Repository(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
this is my interface and its calling class
public interface Github {
@GET("https://stackoverflow.com/users/{user}")
public void getRepo(@Path("user") String user, Callback<Repository> response);
}
public class GitHubService {
private static String API_URL = "https://api.github.com";
public static Github getService() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(API_URL)
.build();
Github github = retrofit.create(Github.class);
return github;
}
请分享堆栈跟踪和分享改装的版本,以及...像β2或3 .... –
com.squareup.retrofit2:改造:2.0.0-BETA4 –
请分享堆栈跟踪.. –