-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Version: 1.14.0-alpha04
Exclusively on various Samsung devices running Android 15, I got many automated crash reports triggered by HarmonizedColors#applyToContextIfAvailable
:
Caused by: java.lang.IllegalArgumentException: Cannot modify resource loaders of ResourcesImpl not registered with ResourcesManager
at android.app.ResourcesManager$UpdateHandler.onLoadersChanged(ResourcesManager.java:2240)
at android.content.res.Resources.addLoaders(Resources.java:2692)
at com.google.android.material.color.ResourcesLoaderUtils.addResourcesLoaderToContext(ResourcesLoaderUtils.java:37)
at com.google.android.material.color.HarmonizedColors.applyToContextIfAvailable(HarmonizedColors.java:75)
It looks like this happen only when an Activity is recreated (for example on orientation change)
The IllegalArgumentException
is thrown by the framework here:
In fact the crash happens whenever ResourcesLoaderUtils#addResourcesLoaderToContext
is called, thus this crash is also triggered if ColorResourcesOverride#applyIfPossible
is called. There are probably other calls affected too.
So, I suppose Samsung screw something in its changes to theming or the system ?
On the app side, is there any other work-around than to guard these calls with a try-catch
block catching IllegalArgumentException
?