OKHttp 2.2.0 - 未实现的抽象方法

时间:2015-03-10 13:05:28

标签: android okhttp

当我使用OKHttp调用Web服务时,我有时会遇到以下堆栈跟踪崩溃:

System.err(12651): java.lang.AbstractMethodError: abstract method not implemented System.err(12651): at com.test.BaseService$3.onFailure(BaseService.java) System.err(12651): at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:154) System.err(12651): at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) System.err(12651): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) System.err(12651): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) System.err(12651): at java.lang.Thread.run(Thread.java:841) dalvikvm(12651): threadid=23: calling UncaughtExceptionHandler

我正在做一个通用方法来调用WS:

RequestBody body = RequestBody.create(JSON_MEDIA_TYPE, jsonRequest); 
Request request = new Request.Builder().url(url).put(body).headers(buildHeaders(url)).build();                 OkHttpClient httpClient = new OkHttpClient(); 
httpClient.newCall(request).enqueue(new Callback() { 

@Override 
public void onFailure(Request request, IOException e) { 
    handleError(e); 
}

@Override public void onResponse(Response response) { 
    handleResponse(response.code(), response.body()); 
} 
}); 

你知道为什么会发生这种崩溃吗?

谢谢

0 个答案:

没有答案