Skip to content
webtoapkfree

Why does my WebView app show an SSL certificate error?

A WebView SSL certificate error means Android rejected your site's certificate. Fix the server chain, dates or hostname instead of calling proceed().

GuidesNookesh Karri

Light cover card with the title 'Why does my WebView app show an SSL certificate error?' in dark text and a green accent bar

A WebView SSL certificate error means Android checked your website’s certificate and rejected it. The cause is almost always on the server: a missing intermediate certificate, an expired or mismatched certificate, or a certificate the device doesn’t trust. Fix the certificate, and the error goes away without touching the app code.

What a WebView SSL certificate error actually means

A WebView SSL certificate error is the WebView refusing an HTTPS connection it can’t verify. When that happens, the WebView calls onReceivedSslError, and per the WebViewClient reference, the default behaviour is to cancel the load. You usually see a blank page or an error page instead of your site.

The callback carries an SslError object. Its primary error tells you which check failed. That code is the fastest clue you have, so log it before you change anything.

Match the error code to the cause

Each SslError code points at a different problem. The SslError reference lists six:

Code What Android says Likely cause Where to fix
SSL_UNTRUSTED The certificate authority is not trusted Missing intermediate certificate, self-signed certificate, or a root the device lacks Server
SSL_EXPIRED The certificate has expired Renewal failed or the old certificate is still installed Server
SSL_NOTYETVALID The certificate is not yet valid Phone clock set in the past Device
SSL_DATE_INVALID The date of the certificate is invalid Wrong device clock or a bad certificate date Device first, then server
SSL_IDMISMATCH Hostname mismatch Certificate covers example.com but the app loads www.example.com Server or app URL
SSL_INVALID A generic error occurred Anything else, including newer WebView rules Check the server with a test tool

My take: if the site opens fine on a laptop, expect SSL_UNTRUSTED. It’s the most common case, so start there.

Why the site works in Chrome but fails in the app

An incomplete certificate chain is the classic reason a site loads in a desktop browser but fails inside a WebView app. A Mozilla bug thread on this exact error notes that Chrome and WebView on Android rely on the server sending the full chain, and SSL Labs flagged that server’s chain as incomplete.

  1. Run your domain through the SSL Labs server test and look for “Chain issues: Incomplete”.
  2. If it’s flagged, download the intermediate bundle from your certificate provider.
  3. Install it on the server next to your certificate, as the missing intermediate guide describes.
  4. Test again, then reopen the app. No rebuild needed.

Check the phone’s date and time

A wrong device clock makes a perfectly good certificate look expired or not valid yet. If only one phone shows the error, this is the first thing to check. Turning on automatic date and time fixes most NET::ERR_CERT_DATE_INVALID cases, as this date error guide explains.

A tester’s phone sits in a drawer for months and boots with the wrong year. Your app fails on that phone only. The server is fine.

Self-signed and private certificates

Self-signed certificates fail in release builds because Android doesn’t trust them. The network security configuration guide says apps targeting Android 6.0 (API level 23) and lower trust user-added CAs by default, while the default config for API 24 and higher lists only system certificates.

For a staging server, you can trust a debug CA with debug-overrides. Those anchors apply only when android:debuggable is true, so the release build still rejects them. For production, use a certificate from a public authority. Let’s Encrypt certificates are free.

The new 200-day certificate rule in recent WebView versions

Recent Chromium-based WebViews reject long-lived certificates from public roots. According to a July 2026 write-up, Chromium requires leaf certificates issued after March 15, 2026 by known roots to have a maximum validity of 200 days. Longer ones fail with CERT_VALIDITY_TOO_LONG (net error -213).

This matters if your host sells multi-year certificates or you installed one manually this year. The site loads on an older phone and fails on one with an updated WebView. Most guides on this error predate the rule. Keeping Android System WebView up to date on your test phones helps you catch it early.

Old Android versions and missing root certificates

Very old Android versions may not trust newer root certificates at all. Let’s Encrypt has said that Android versions prior to 7.1.1 don’t trust its ISRG Root X1 root.

If you build with WebToAPK Free, this case doesn’t apply: generated apps require Android 8.0 or newer. If your own native project supports older versions, test on one before you blame the server.

Why calling handler.proceed() is the wrong fix

Calling handler.proceed() hides the error by accepting every certificate, including a forged one. Google’s SSL error handler help page says an unsafe onReceivedSslError implementation makes the app vulnerable to man-in-the-middle attacks. It also warns that apps with unfixed security issues may be removed from Google Play after the deadline shown in Play Console.

Google’s guidance is to call proceed() only when the certificate meets your expectations, and cancel() otherwise. The WebViewClient docs go further: apps should cancel and never prompt the user about SSL errors. Failing http:// requests are a different error; see ERR_CLEARTEXT_NOT_PERMITTED.

How to confirm the fix worked

The fix worked when the page loads in the app on the same phone that failed before, with no rebuild. If it still fails, connect the phone and inspect the WebView with Chrome DevTools to read the exact network error. A page that loads but stays empty is usually a separate problem; the WebView white screen guide covers those causes.

One limitation: no WebView app setting fixes a broken certificate on someone else’s server. If the site isn’t yours, only the owner can fix it. WebToAPK Free website sections need a complete HTTPS address, so the website to APK guide assumes a working certificate from the start.

FAQ

Why does my site work in Chrome but show an SSL error in my WebView app?

Usually the server isn’t sending its full certificate chain. Desktop browsers can sometimes fill the gap, but Chrome and WebView on Android rely on the server sending every intermediate certificate.

Can I just call handler.proceed() in onReceivedSslError?

No. Google says an unsafe onReceivedSslError implementation leaves the app open to man-in-the-middle attacks, and apps with unfixed vulnerabilities may be removed from Google Play after the deadline in Play Console.

Why does the SSL error only happen on one phone?

Check that phone’s date and time first. A wrong clock makes a valid certificate look expired or not yet valid. Also check the WebView version, since newer versions enforce stricter certificate rules.

Will a self-signed certificate work in a WebView app?

Not in a release build. Apps targeting API level 24 and higher trust only system CAs by default. You can trust a debug CA with debug-overrides, but only while the app is debuggable.

Sources