OkHttpClient cannot resolve method setCache
In 3.x a bunch of methods on OkHttpClient
were moved into methods on OkHttpClient.Builder
. You want something like this:
File httpCacheDirectory = new File(getCacheDir(), "responses");
int cacheSize = 10*1024*1024;
Cache cache = new Cache(httpCacheDirectory, cacheSize);
OkHttpClient client = new OkHttpClient.Builder()
.addNetworkInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR)
.cache(cache)
.build();