You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(android): SystemBars crashes on launch when the WebView versionName is not numeric ("Developer Build") — regression of #6781 #8738
@capacitor/core 8.5.2, @capacitor/android 8.5.2. The code involved is the same on main and in 8.6.2.
Platforms Affected
Android
iOS
Web
Current Behavior
On a device whose system WebView reports a versionName that does not start with a number — e.g. Developer Build, the name of a WebView built from source, seen on custom ROMs and on AOSP userdebug images (same condition as #6144 and #6781) — a Capacitor 8 app crashes during its first layout pass, on every launch, before anything is drawn:
java.lang.NumberFormatException: For input string: "Developer Build"
at java.lang.Integer.parseInt(Integer.java:617)
at java.lang.Integer.valueOf(Integer.java:807)
at com.getcapacitor.plugin.SystemBars.getWebViewMajorVersion(SystemBars.java:347)
at com.getcapacitor.plugin.SystemBars.lambda$initWindowInsetsListener$4(SystemBars.java:194)
at androidx.core.view.ViewCompat$Api21Impl$1.onApplyWindowInsets(ViewCompat.java:5322)
at android.view.View.dispatchApplyWindowInsets(View.java:9227)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:6929)
at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:1568)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1670)
SystemBars.getWebViewMajorVersion() reads the version with no guard:
and it is called from the window-insets listener the plugin installs on the decor view (initWindowInsetsListener, and from getBottomInset inside it), so the exception is thrown on the main thread. The plugin is a core plugin loaded at startup, so an app cannot opt out other than with insetsHandling: "disable".
This looks like a regression of the case fixed in #6863 / #6891 for Bridge.isMinimumWebViewInstalled(), which takes the first run of digits and answers false when there is none. SystemBars, added in v8, reads the version again without that handling.
Expected Behavior
A WebView version that is not a number is treated as unknown (0), as Bridge.isMinimumWebViewInstalled() already does, and the app starts.
Project Reproduction
No project is needed beyond a default Capacitor 8 Android app. On any device or image whose WebView package has versionName = "Developer Build", launch the app with the default SystemBars configuration: it crashes on the first frame with the stack above. Other names throw in the same line: an empty versionName, one that starts with a letter or a space, and "." (which splits into an empty array).
Activity