okhttp的2.6.0版本
使用https 链接接口时 执行 cancel() 会引发应用crash
暂时解决办法 是 把cancel() 放在background线程执行
okHttpClient.getDispatcher().getExecutorService().execute(new CancelRunnable (requestTag, okHttpClient));
public class CancelRunnable implements Runnable { Object requestTag; OkHttpClient okHttpClient; public CancelRunnable(Object requestTag, OkHttpClient okHttpClient) { this.requestTag = requestTag; this.okHttpClient = okHttpClient; } @Override public void run() { if (okHttpClient != null && requestTag != null) { okHttpClient.cancel(requestTag); } }}