2
OkHttpClient client = new OkHttpClient();
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);

throws "CookieManager is abstract, cannot be instantiated"

I'm importing android.webkit.CookieManager and everything seems fine from the documentation side.

VCUcompSci
  • 25
  • 5

1 Answers1

2

Because the cookiemanager manages all the cookies, you can not create intances of it. That would mean one instance got different cookies that another. The cookiemanager is therefor a so called singleton. Use CookieManager cookieManager = CookieManager.getInstance() You can look it up here

Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116