The method execute(Request) is undefined for the type OkHttpClient
You are getting this exception because there is no such method ie.execute(Request
) for OkHttpClient
. Rather it is invoked on Call
object which is obtained using OkHttpClient
object as follows:
Call call = client.newCall(request);
Response response = call.execute();
I think you should be using
Response response = client.newCall(request).execute();
instead of Response response = client.execute(request);