OkHttp 3 and HttpURLConnection

I am a little confused about how to upgrade OkHttp to version 3.0 while keeping our code that uses HttpURLConnection. Our current dependencies:

compile 'com.squareup.okhttp:okhttp:2.7.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.0'

In an altered state, it is indicated:

Apache HTTP API and HttpURLConnection API are deprecated. They continue to work as usual, but we are moving everything to the new OkHttp 3 API. The okhttp-apache and okhttp-urlconnection modules should only be used to speed up the transition to the OkHttp request / response API. These obsolete modules will be removed in the upcoming version of OkHttp 3.x.

Unfortunately, I don’t understand what “we are translating everything to the new OkHttp 3 API”.

I tried to depend on com.squareup.okhttp:okhttp-urlconnection:3.0.0, but this does not exist.

Should I save com.squareup.okhttp:okhttp-urlconnection:2.7.0and upgrade only com.squareup.okhttp:okhttpto 3.0.0? Or does this suggestion mean that depending only on com.squareup.okhttp:okhttpshould work?

+4
source share
1 answer

I tried to depend on com.squareup.okhttp:okhttp-urlconnection:3.0.0, but this does not exist.

Names have also been updated. Now

com.squareup.okhttp3:okhttp-urlconnection:3.0.0

pay attention to okhttp3 instead of okhttp

See jCenter .

+7
source

Source: https://habr.com/ru/post/1624240/


All Articles