According to the official change log :
URLConnection support has moved to the okhttp-urlconnection module. If you upgrade from 1.x, this change will affect you. You will need to add the okhttp-urlconnection module to your project and use OkUrlFactory to create new instances of HttpURLConnection:
// OkHttp 1.x: HttpURLConnection connection = client.open(url); // OkHttp 2.x: HttpURLConnection connection = new OkUrlFactory(client).open(url);
Remember to add the dependency as shown below to the Gradle file.
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
source share