fix(widget): widgets stuck on loading spinner in release build (#18) #22

Merged
makiolaj merged 1 commits from fix/widget-release into main 2026-06-21 12:15:44 +00:00
Owner

Closes #18 — home-screen widgets showed only a loading spinner in the published F-Droid (R8-minified) release build, while working fine in debug.

Root cause

Glance renders every widget through a WorkManager worker (androidx.glance.session.SessionWorker). Before running a worker, WorkManager instantiates its InputMerger reflectively from the fully-qualified class name stored in the WorkSpec (Class.newInstance(), no-arg constructor). Under R8 full mode (AGP 9 default), the unused no-arg constructor of androidx.work.OverwritingInputMerger was stripped, so:

WM-InputMerger: java.lang.InstantiationException: androidx.work.OverwritingInputMerger has no zero argument constructor
WM-WorkerWrapper: Could not create Input Merger

The SessionWorker never ran → provideContent never executed → the widget stayed on its initial loading layout (glance_default_loading_layout, a spinner) forever. Same R8-reflection family as the v2.7.0 Room keep-rule fix.

Fix

Keep the name + constructor of every androidx.work.InputMerger (one proguard rule).

Verification (three-way, on-device)

Built the R8-minified releaseTest variant and compared widgets side by side:

  • debug (not minified): SessionWorker SUCCESS — renders.
  • production 2.7.x (minified, control): InputMerger InstantiationException — spinner.
  • releaseTest with the fix: spinner → renders the 'Upcoming' widget content; no more InputMerger error.

Cuts v2.7.3 (CHANGELOG + version bump + fastlane changelog included).

Closes #18 — home-screen widgets showed only a loading spinner in the published F-Droid (R8-minified) release build, while working fine in debug. ## Root cause Glance renders every widget through a WorkManager worker (`androidx.glance.session.SessionWorker`). Before running a worker, WorkManager instantiates its **InputMerger** reflectively from the fully-qualified class name stored in the WorkSpec (`Class.newInstance()`, no-arg constructor). Under **R8 full mode** (AGP 9 default), the unused no-arg constructor of `androidx.work.OverwritingInputMerger` was stripped, so: ``` WM-InputMerger: java.lang.InstantiationException: androidx.work.OverwritingInputMerger has no zero argument constructor WM-WorkerWrapper: Could not create Input Merger ``` The SessionWorker never ran → `provideContent` never executed → the widget stayed on its initial loading layout (`glance_default_loading_layout`, a spinner) forever. Same R8-reflection family as the v2.7.0 Room keep-rule fix. ## Fix Keep the name + constructor of every `androidx.work.InputMerger` (one proguard rule). ## Verification (three-way, on-device) Built the R8-minified `releaseTest` variant and compared widgets side by side: - **debug** (not minified): `SessionWorker SUCCESS` — renders. - **production 2.7.x** (minified, control): InputMerger InstantiationException — spinner. - **releaseTest with the fix**: spinner → renders the 'Upcoming' widget content; no more InputMerger error. Cuts **v2.7.3** (CHANGELOG + version bump + fastlane changelog included).
makiolaj added 1 commit 2026-06-21 12:06:56 +00:00
fix(widget): keep WorkManager InputMerger so widgets render under R8 (#18)
All checks were successful
CI / ci (pull_request) Successful in 8m45s
bc59200f77
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) <noreply@anthropic.com>
makiolaj scheduled this pull request to auto merge when all checks succeed 2026-06-21 12:09:28 +00:00
makiolaj merged commit eb51175ceb into main 2026-06-21 12:15:44 +00:00
makiolaj referenced this issue from a commit 2026-07-13 13:32:18 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: makiolaj/calendula#22