fix(android): remove WorkManager auto-initializer (lintVitalRelease)
android / Build + lint + test (push) Successful in 4m26s
android / Build signed release APK (push) Has been skipped

The android.yml release build (run 110, job 282) failed at
lintVitalRelease with:

  AndroidManifest.xml:13: Error: Remove androidx.work.WorkManagerInitializer
  from your AndroidManifest.xml when using on-demand initialization.
  [RemoveWorkManagerInitializer from androidx.work]

MinstrelApplication implements androidx.work.Configuration.Provider
and supplies the HiltWorkerFactory, so WorkManager initializes
on-demand at first WorkManager.getInstance(...) call. The androidx-
startup InitializationProvider that ships with the work-runtime
library still auto-registers WorkManagerInitializer, racing the
on-demand path. Lint catches this as a release blocker.

Fix: merge the InitializationProvider entry and remove the nested
WorkManagerInitializer meta-data with tools:node='remove'. This is
the AOSP-recommended fix when an Application is its own
Configuration.Provider.
This commit is contained in:
2026-06-01 16:55:29 -04:00
parent 3bcc7f3eb3
commit f080afc38c
+16
View File
@@ -50,5 +50,21 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<!-- On-demand WorkManager initialization: MinstrelApplication
implements Configuration.Provider and supplies the
HiltWorkerFactory. Remove the default startup-driven
initializer so WorkManager picks up our config instead of
auto-initializing with the wrong factory. lintVitalRelease
flags this as a fatal error if left in place. -->
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="merge">
<meta-data
android:name="androidx.work.WorkManagerInitializer"
android:value="androidx.startup"
tools:node="remove" />
</provider>
</application>
</manifest>