1

To use OkHttp in a Gradle build, I need to add the following dependency to the Gradle build.

compile 'com.squareup.okhttp:okhttp:2.5.0' 

Does that mean I am using okhttp-urlconnection module which implements the familiar java.net.HttpURLConnection API OR the okhttp-apache module which implements the Apache HttpClient API?

lyc001
  • 777
  • 1
  • 10
  • 25
  • 1
    okhttp is the http library implemented by Square. https://github.com/square – cgr Dec 14 '15 at 10:07
  • Use `Response/Request` API. The others will be deprecated soon. Read this: https://publicobject.com/2015/12/15/okurlfactory-is-going-away/ – denvercoder9 Dec 15 '15 at 07:16

2 Answers2

2

Have you copied Lines? :) :)

Documentations Says:

You can try out OkHttp without rewriting your network code. The okhttp-urlconnection module implements the familiar java.net.HttpURLConnection API and the okhttp-apache module implements the Apache HttpClient API.

OkHttp supports Android 2.3 and above. For Java, the minimum requirement is 1.7.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
0

It means you can use this library classes. I have used this library with retrofit.

import com.squareup.okhttp.OkHttpClient;
OkHttpClient okHttpClient = new OkHttpClient();
RestAdapter restAdapter = new RestAdapter.Builder()
            .setEndpoint(ContextConstants.REPORT_SUBMIT_PATH)
            .setClient(new OkClient(okHttpClient))
            .build();
nAkhmedov
  • 3,522
  • 4
  • 37
  • 72