R8 full mode bug crashes Compose apps at startup with java.lang.VerifyError
In apps built with R8 full mode[1], R8 miscompiles methods of androidx.compose.material3.TextKt when no keep rule[2] covers Compose @Composable methods, and the app crashes with java.lang.VerifyError the first time it composes a Text element. The cause is a parallel-move ordering error in R8's register allocator: it overwrites register v6 before the wide (long) register pair v6:v7 has been read, so ART[3] rejects the class — and even if verification passed, the sequence would produce wrong values. The crash reproduced with R8 9.3.16, 9.4.24 and 9.5.26 on both API 29 (Android 10) and API 36 (Android 16) devices.
A minimal app built with the same R8 versions does not reproduce it, since the bug depends on code shapes produced by whole-program optimizations such as argument removal and specialization at the app's call sites. On API 36 devices, adb shell cmd package compile -m verify -f logs no failure, and the problem shows up only at runtime. The fix commit, "Fix registor allocator clobbering live wide register pair", landed in the R8 9.3–9.6 branches; versions 9.3.35, 9.4.34, 9.5.28 and 9.6.0-alpha06 (an alpha) are published on Maven, 9.3.34, 9.4.33 and 9.5.27 also contain the fix but were not published to Maven, and nothing was backported to the R8 8.9–9.2 branches.
As of 2026-10-28, AGP[4] 9.3.3 bundles R8 9.3.28, AGP 9.4.1 bundles R8 9.4.24 and AGP 9.5.0-rc01 bundles R8 9.5.26, all without the fix, while the preview releases AGP 9.5.0-rc02 (R8 9.5.28) and AGP 9.6.0-alpha01 (R8 9.6.0-alpha06) include it; for the latter, the commit hash of the bundled R8 could not be found in the public repository, so the version was determined from the name 9.6.0-alpha06. A comment on the issue (#14, a google.com account) says it remains uncertain whether both the AGP 9.4 patch release and the stable AGP 9.5.0 will include the fix. For stable AGP users there are two workarounds: raise only R8 to a fixed version via pluginManagement { buildscript { classpath("com.android.tools:r8:<version>") } }, or exclude androidx @Composable methods from optimization with -keepclasseswithmembers and -keepclassmembers rules on androidx.** classes.
Read the original issuetracker.google.comDiscussion on GeekNews
Sources
-
KRGeekNews KO
구글 R8이 Compose Text를 잘못 최적화해 앱이 켜지자마자 죽는 버그


