Answer the question
In order to leave comments, you need to log in
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
First, you still need to add import
this OkHttpClient
in 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 questionAsk a Question
731 491 924 answers to any question