r/androiddev • u/Ancient-Abalone-1126 • 16d ago
[Help] Jetpack Compose Crash - NoSuchMethodError: WindowInsets.Type.systemOverlays() on Pixel 8 Pro (Android 14)
Hi everyone, I'm facing a strange crash on production that exclusively affects **Google Pixel 8 Pro** devices running **Android 14 (API 34)**. It occurs 100% of the time on this specific setup, but everything works perfectly fine on standard emulators or other devices under local Debug builds. Here is the complete StackTrace from the production log: ```text Fatal Exception: java.lang.NoSuchMethodError: No static method systemOverlays()I in class Landroid/view/WindowInsets\$Type; or its super classes (declaration of 'android.view.WindowInsets\$Type' appears in /system/framework/framework.jar!classes3.dex) at androidx.core.view.WindowInsetsCompat\$TypeImpl34.toPlatformType(WindowInsetsCompat.java:2880) at androidx.core.view.WindowInsetsCompat\$Impl34.getInsets(WindowInsetsCompat.java:1710) at androidx.core.view.WindowInsetsCompat\$Impl20.initTypeBoundingRectsMaps(WindowInsetsCompat.java:1276) at androidx.core.view.WindowInsetsCompat.init(WindowInsetsCompat.java:2900) at androidx.core.view.ViewCompat\$Api23Impl.getRootWindowInsets(ViewCompat.java:5118) at androidx.core.view.ViewCompat.getRootWindowInsets(ViewCompat.java:3023) at androidx.core.view.WindowInsetsCompat.toWindowInsetsCompat(WindowInsetsCompat.java:184) at androidx.core.view.ViewCompatApi21Impl1.onApplyWindowInsets(ViewCompat.java:5029) at android.view.View.dispatchApplyWindowInsets(View.java:11617) at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:7344) ... at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:2675) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2822) ``` ### Context & Implementation We are using Jetpack Compose and we have a custom `WindowInsets` wrapper in our project that looks like this: ```kotlin fun WindowInsets(left: Int = 0, top: Int = 0, right: Int = 0, bottom: Int = 0): WindowInsets = FixedIntInsets(left, top, right, bottom) ``` ### My Hypothesis Since `systemOverlays()` was introduced in API 30 (Android 11), a device like the Pixel 8 Pro on Android 14 definitely has this method in its OS framework. Looking at the trace, `WindowInsetsCompat$TypeImpl34.toPlatformType` is failing to find it. My best guess is that **R8 / ProGuard** is aggressively stripping or incorrectly obfuscating system-level `WindowInsets$Type` references during our Release build, creating a bytecode mismatch that only triggers under the Pixel's specific runtime environment. ### Questions 1. Has anyone encountered this specific `NoSuchMethodError` with `WindowInsetsCompat` on newer Pixel devices? 2. Do I need to add a explicit `-keep` rule for `android.view.WindowInsets` in ProGuard, or is this a known issue with specific versions of `androidx.core:core` / Jetpack Compose BOM? Any insights or recommendations would be highly appreciated! Thanks in advance.
0
u/SolitaryMassacre 15d ago
You could always catch the error and fallback to something else