I get an CertPathValidatorException issue in webview
<p>This is my webview:</p>

<pre><code>  if(bundle != null){
        String file = bundle.getString("url");
        Log.i("","url is:" + file);
        wv.setWebViewClient(new MyWebViewClient());
        wv.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        WebSettings settings = wv.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        settings.setAppCacheEnabled(false);
        settings.setDomStorageEnabled(true);
        wv.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {
                loadingPanel.setVisibility(View.GONE);
            }
        });
        wv.loadUrl(file);
    }
</code></pre>

<p>This is my WebViewClient:</p>

<pre><code>  private class MyWebViewClient extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        wv.loadUrl(url);
        return true;
    }

    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler,
                                   SslError error) {
        super.onReceivedSslError(view, handler, error);
        Log.e("","error is certificate:" + error.getCertificate());
        Log.e("","error is:" + error.getPrimaryError());
        Log.e("","error is url:" + error.getUrl());
        handler.proceed();
    }
}
</code></pre>

<p>I get this error back:</p>

<pre><code>10-12 13:27:43.174: I/X509Util(14748): Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
</code></pre>

<p>Also, the "onReceivedSSLError method is not being reached. I do not get the logs that I added inside that function". What am I doing wrong?</p>

<p>Also this are the permissions that I have, I don't know if I need more or not:</p>

<pre><code>android.permission.INTERNET"
android.permission.READ_EXTERNAL_STORAGE"
</code></pre>

<p>I even tried to add the certificate to the webview, like this:</p>

<pre><code> try {
            String keyStoreType = KeyStore.getDefaultType();
            KeyStore keyStore = KeyStore.getInstance(keyStoreType);
            keyStore.load(null, null);
            Certificate cer = keyStore.getCertificate("ca");
            if(cer != null) {
                Log.i("", "certificate is:" + cer);
                Log.i("", "certificate is:" + cer.toString());
                Log.i("", "certificate is:" + cer.getType());
                Log.i("", "certificate is:" + cer.getPublicKey());
                X509Certificate x509 = (X509Certificate) cer;
                SslCertificate sslCert = new SslCertificate(x509);
                wv.setCertificate(sslCert);
            }
        }catch (Exception e){
            Log.e("","error trying to get it:" + e.getMessage());
        }
</code></pre>

<p>But no luck.</p>