Answer the question
In order to leave comments, you need to log in
Why does an error occur when sending a GET request via Okhttp?
I have the following code
OkHttpClient client;
Request request = new Request.Builder()
.url("http://private-anon-2e719df222-newsapitest.apiary-proxy.com/api/news/football")
.build();
Response response = client.newCall(request).execute();
Answer the question
In order to leave comments, you need to log in
Because the client is not initialized. This is exactly what is said in the error, and this can be seen from the code below.
I think the link to the documentation will be more complete help in the question of how to initialize it.
https://square.github.io/okhttp/3.x/okhttp/okhttp3...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question