Search code examples
javaandroidandroid-studioassets

Android html file not found


I have a folder assets in app directory with error.html file. It has been created via File->New->Folder->Assets Folder. I would like to show this file in method

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error)
{
    String path = "file:///android_assets/error.html";
    view.loadUrl(path);
}

but I am still getting an error file not found. I tried also "file:///app/android_assets/error.html" and "file:///assets/error.html" and "file:///app/assets/error.html" but still the same result. Can somebody tell me plaes where the file really is? It drives me crazy. Thanks a lot.


Solution

  • Use file:///android_asset/error.html.