From bc59200f77ada802e0f674935ca22a55351ec248 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Sun, 21 Jun 2026 14:06:34 +0200 Subject: [PATCH] fix(widget): keep WorkManager InputMerger so widgets render under R8 (#18) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Home-screen widgets were stuck on the Glance loading layout (a blank spinner) in the minified release build — but worked in debug. Root cause: Glance renders every widget through a WorkManager worker (androidx.glance.session.SessionWorker), and WorkManager instantiates the InputMerger reflectively from the fully-qualified class name persisted in the WorkSpec (Class.newInstance, no-arg ctor). Under R8 full mode (AGP 9 default) the unused no-arg constructor of androidx.work.OverwritingInputMerger was stripped, so WorkManager threw "OverwritingInputMerger has no zero argument constructor", the SessionWorker never ran, and provideContent never executed — leaving the widget on its initial loading layout forever. Same R8-reflection family as the v2.7.0 Room keep-rule fix. Keep the name + constructor of every androidx.work.InputMerger. Verified on-device with the releaseTest build (R8-minified): the agenda widget, which showed only a spinner before, now renders its content; the WM-InputMerger InstantiationException is gone. Closes #18. Cuts v2.7.3. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 8 ++++++++ app/build.gradle.kts | 4 ++-- app/proguard-rules.pro | 11 +++++++++++ fastlane/metadata/android/en-US/changelogs/20703.txt | 6 ++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/20703.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index baa0fab..2bb77c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.7.3] — 2026-06-21 + +### Fixed +- Home-screen widgets no longer get stuck on a loading spinner in the published + (F-Droid) release build. They render via Android's background-work system, and + release optimisation (R8) was stripping a helper class it loads by name, so the + render job never ran. Added the missing keep rule — widgets now load normally. + ## [2.7.2] — 2026-06-21 ### Added diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 86b2587..169c68e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -28,8 +28,8 @@ android { // which builds this version and then creates the matching vX.Y.Z tag + // release itself (versionCode is pinned to MAJOR*10000 + MINOR*100 + // PATCH from versionName, e.g. 2.7.2 -> 20702). See docs/RELEASING.md. - versionCode = 20702 - versionName = "2.7.2" + versionCode = 20703 + versionName = "2.7.3" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index dce5b77..fd9c2c8 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -15,3 +15,14 @@ # Keep the generated Room database implementations fully intact. -keep class * extends androidx.room.RoomDatabase { *; } -dontwarn androidx.room.paging.** + +# WorkManager instantiates an InputMerger reflectively (Class.newInstance) from +# the fully-qualified class name persisted in the WorkSpec, so the class must +# keep both its name and a no-arg constructor. Glance renders every widget +# through a WorkManager worker (androidx.glance.session.SessionWorker) whose +# default merger is androidx.work.OverwritingInputMerger. Under R8 full mode +# (AGP 9 default) that unused no-arg constructor was stripped, so WorkManager +# threw "OverwritingInputMerger has no zero argument constructor", the +# SessionWorker never ran, and widgets were stuck on their loading layout +# (a blank spinner) in release builds. Keep every InputMerger's name + ctor. +-keep class * extends androidx.work.InputMerger { (...); } diff --git a/fastlane/metadata/android/en-US/changelogs/20703.txt b/fastlane/metadata/android/en-US/changelogs/20703.txt new file mode 100644 index 0000000..124d6b7 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/20703.txt @@ -0,0 +1,6 @@ +### Fixed +- Home-screen widgets no longer get stuck on a loading spinner in the published + (F-Droid) release build. They render via Android's background-work system, and + release optimisation (R8) was stripping a helper class it loads by name, so the + render job never ran. Added the missing keep rule — widgets now load normally. +