com.squareup.okhttp.HttpResponseCache Cannot resolve symbol 'HttpResponseCache'

402 Views Asked by At

I'm trying to compile an Android project in Android Studio which imports:

com.squareup.okhttp.HttpResponseCache

I'm getting an error "Cannot resolve symbol 'HttpResponseCache' "

I've tried adding in the gradle the following dependencies without success:

compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.0'
compile 'com.squareup.okhttp:okhttp:2.7.0'
compile 'com.squareup:otto:1.3.8'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp3:okhttp:3.1.2'

Which library/s should I include to use HttpResponseCache?

2

There are 2 best solutions below

4
On

According to the documentation, you should import android.net.http.

0
On

Apparently com.squareup.okhttp.HttpResponseCache was deprecated after v1. I do not see it included in the package after v2.0.0

If you want to use it, add:

'com.squareup.okhttp:okhttp:1.6.0'