From 8bacb6b7d2430b18d2173c44972e042b661e4858 Mon Sep 17 00:00:00 2001 From: Dan Smolsky Date: Sat, 21 Nov 2026 00:30:34 -0500 Subject: [PATCH 1/2] fix(app): keep OkHttp's IDN table out of the hostname method Play reports a native crash (SIGSEGV) in JIT-compiled OkHttp hostname code while building request URLs, on many arm64 devices. R8 inlines OkHttp's IDN mapping table and its large string constants into the hostname method, which ART's JIT likely miscompiles. Keeping the okhttp3.internal.idn classes leaves the table in its own class. In the R8 benchmark build the hostname method drops from 1,870 to 651 code units and no longer loads the table strings; the APK grows by 16 KB. The benchmark build starts, connects to session-lab and opens a session on the emulator, and scripts/check.sh passes. The crash itself couldn't be reproduced (x86_64 emulator, arm64 reports), so the next release's crash numbers are the proof. Part of #245 and #249 --- app/build.gradle.kts | 2 +- app/proguard-rules.pro | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 app/proguard-rules.pro diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d3cc50677..55e8fbdfb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -32,7 +32,7 @@ android { // and devirtualises the runtime. Every library we use ships its own keep rules. isMinifyEnabled = true isShrinkResources = true - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } create("benchmark") { initWith(getByName("release")) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 000000000..31a10fdca --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,2 @@ +# ART's JIT crashes in OkHttp's hostname code when R8 inlines the IDN mapping table's strings into it. +-keep,allowobfuscation class okhttp3.internal.idn.** { ; ; } From bf22d48678758284e40906c69ef3bd7e37de4823 Mon Sep 17 00:00:00 2001 From: Dan Smolsky Date: Sat, 21 Nov 2026 00:58:02 -0500 Subject: [PATCH 2/2] chore(app): word the IDN keep rule comment as a workaround The comment above the rule no longer states the crash's cause as fact, and the release build type's comment now mentions proguard-rules.pro. Comment-only change; the rule is unchanged. Checked with scripts/check.sh :app. Part of #245 and #249 --- app/build.gradle.kts | 3 ++- app/proguard-rules.pro | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 55e8fbdfb..0285f618d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -29,7 +29,8 @@ android { } release { // R8 is what makes Compose fast in release: it strips the debug-only paths, inlines - // and devirtualises the runtime. Every library we use ships its own keep rules. + // and devirtualises the runtime. Libraries ship their own keep rules; + // proguard-rules.pro holds workarounds. isMinifyEnabled = true isShrinkResources = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 31a10fdca..d777a1518 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,2 +1,2 @@ -# ART's JIT crashes in OkHttp's hostname code when R8 inlines the IDN mapping table's strings into it. +# Works around a native crash in JIT-compiled OkHttp hostname parsing by keeping the IDN table out of that method. -keep,allowobfuscation class okhttp3.internal.idn.** { ; ; }