R
R
run1822017-02-16 00:12:11
Java
run182, 2017-02-16 00:12:11

How to make a request using OkHttp?

I downloaded the library from square.github.io/okhttp I added it to the /libs/
directory Gradle says compile fileTree(dir: 'libs', include: ['*.jar']) But Android Studio complains about OkHttpClient.

OkHttpClient client = new OkHttpClient();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2017-02-16
@run182

First, you still need to add importthis OkHttpClientin the code.
Secondly, if Gradle, then it would be better not to connect it manually, but by adding it to dependencies, when building Gradle, it will download and connect itself.
Thirdly, there is no point in OkHttp, even together with Retrofit the usefulness of this system is doubtful, and by itself it is generally useless, think for yourself - what it gives, it is better to write such a class yourself, the APK will be smaller.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question