Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setAppCachePath and setAppCacheEnabled these are not work in android 33

webView.getSettings().setAppCachePath("/data/data/" + getPackageName() + "/cache");
webView.getSettings().setAppCacheEnabled(true);
error: cannot find symbol
        webView.getSettings().setAppCachePath("/data/data/" + getPackageName() + "/cache");
                             ^
  symbol:   method setAppCachePath(String)
  location: class WebSettings

What is an alternative for these lines?

private void enableHTML5AppCache() {
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setAppCachePath("/data/data/" + getPackageName() + "/cache");
    webView.getSettings().setAppCacheEnabled(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
}

Can anyone provide me a solution of these errors?

like image 240
Hostrings Avatar asked May 30 '26 17:05

Hostrings


1 Answers

you can use

webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
like image 78
Andrain Avatar answered Jun 01 '26 09:06

Andrain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!