在android应用程序中使用改装时出错
我正在为我的android应用程序使用翻新1.8,以将get请求发送到以下链接。这是我放置接口的类在android应用程序中使用改装时出错,android,get,retrofit,Android,Get,Retrofit,我正在为我的android应用程序使用翻新1.8,以将get请求发送到以下链接。这是我放置接口的类 package base; import model.User; import retrofit.Callback; import retrofit.http.GET; import retrofit.http.Path; public class Interfaces { public interface getUser { @GET("/api/posts/2")
package base;
import model.User;
import retrofit.Callback;
import retrofit.http.GET;
import retrofit.http.Path;
public class Interfaces {
public interface getUser {
@GET("/api/posts/2")
public void getUser(Callback<User> response);
}
}
在我的活动中,我这样调用请求
public void ApiTest(){
Interfaces.getUser call = RetrofitSingleton.getInstance().create(Interfaces.getUser.class);
call.getUser( new Callback<User>() {
@Override
public void success(User user, Response response) {
setCurrentUser(new User("yessss", "yessss", "yessss"));
}
@Override
public void failure(RetrofitError error) {
setCurrentUser(new User("no,", "no", "no"));
Log.d("hello", error.toString());
}
});
}
知道这个错误可能是什么吗?请发布您的整个stacktrace,以及您用于此呼叫的用户模型。也请张贴您的Gradle文件。据我所知,看起来你做的每件事都是正确的。这似乎是库不匹配。如有不推荐的内容,请发布您的整个stacktrace,可能还有您用于此调用的用户模型。也请张贴您的Gradle文件。据我所知,看起来你做的每件事都是正确的。这似乎是库不匹配。好像有些东西被弃用了
public void ApiTest(){
Interfaces.getUser call = RetrofitSingleton.getInstance().create(Interfaces.getUser.class);
call.getUser( new Callback<User>() {
@Override
public void success(User user, Response response) {
setCurrentUser(new User("yessss", "yessss", "yessss"));
}
@Override
public void failure(RetrofitError error) {
setCurrentUser(new User("no,", "no", "no"));
Log.d("hello", error.toString());
}
});
}
retrofit.RetrofitError: No static field METHODS of type Ljava/util/Set; in class Lcom/squareup/okhttp/internal/http/HttpMethod; or its superclasses (declaration of 'com.squareup.okhttp.internal.http.HttpMethod' appears in /data/app/com.karim.m3-2/base.apk)