Android Studio Javac error - Task :app:compileDebugJavaWithJavac FAILED. Cannot find symbol method setAppCacheMaxSize(Long)

Viewed 90

Here is code of that file.

public void initWebView() {
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLoadWithOverviewMode(true);
    **webView.getSettings().setAppCacheMaxSize(AppConstant.SITE_CACHE_SIZE);
    webView.getSettings().setAppCachePath(mContext.getCacheDir().getAbsolutePath());**
    webView.getSettings().setAllowFileAccess(true);
    **webView.getSettings().setAppCacheEnabled(true);**
    webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setDefaultTextEncodingName("utf-8");
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    if (!isNetworkAvailable(mContext)) {
        webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    }

Error:

    webView.getSettings().setAppCacheMaxSize(AppConstant.SITE_CACHE_SIZE); error: cannot find symbol
                             ^
  symbol:   method setAppCacheMaxSize(long)
  location: class WebSettings

    error: cannot find symbol
        webView.getSettings().setAppCachePath(mContext.getCacheDir().getAbsolutePath());
                             ^
  symbol:   method setAppCachePath(String)
  location: class WebSettings


error: cannot find symbol
        webView.getSettings().setAppCacheEnabled(true);
                             ^
  symbol:   method setAppCacheEnabled(boolean)
  location: class WebSettings

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors

> Task :app:compileDebugJavaWithJavac FAILED
0 Answers
Related