我正在尝试通过 shouldOverrideUrlLoading() 方法在 webview 中获取 cookie,但出现此错误。请看我下面的代码,
WebViewClient loginClient = new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
CookieManager cookieManager = CookieManager.getInstance();
final String cookie = cookieManager.getCookie(url);
//Some Code after this
}
}
我得到这个错误,
java.lang.IllegalStateException: CookieSyncManager::createInstance() needs to be called before CookieSyncManager::getInstance()