How to use JavaNetCookieJar with OkHttp in Android Studio?

15 views Asked by At

I have the following code to store the cookies that my server will return when making a request.

import okhttp3.*;


        OkHttpClient client = new OkHttpClient();
        CookieJar cookieJar = new JavaNetCookieJar(new CookieManager());
        OkHttpClient clientWithCookies = client.newBuilder()
                .cookieJar(cookieJar)
                .build();

And although I have used several versions of okhttp3, all of them do not recognize 'JavaNetCookieJar' and show me the error "Cannot resolve symbol 'JavaNetCookieJar'"

Currently, this is the version I have installed on my grandle:

    implementation 'com.squareup.okhttp3:okhttp:4.9.3'

Could you help me?

0

There are 0 answers